Archive: Why doesnt this command work?


Why doesnt this command work?
ExecWait 'cscript "$INSTDIR\helpers\sys.vbs" > systemsummary.txt'

I have this command in my nsis script. The idea is to run the WSH script 'sys.vbs' and to send the output to the file systemsummary.txt, instead of the screen. That way, if the end user has a problem post-install, he or she can send me the file 'systemsummary.txt' and I can get an idea of how their system is configured, what services are running, etc.

As far as I can tell, the script is not executing and the text file isn't being created. The line right before this one is an execwait that runs a different WSH script, and it's working fine... Can anyone help me?

Thanks!


You need to execute it under command prompt correct?
If so you need to include the path to COMSPEC (Dos command-line).

Something like this:

Push $R0
ReadEnvStr $R0 "COMSPEC"
ExecWait '$R0 cscript "$INSTDIR\helpers\sys.vbs" > systemsummary.txt'
Pop $R0

You're also using a relative path to cscript. Is it in the shell, or shouldn't you supply the full path? Similarely, shouldn't you supply the full path for the output file?

Lastly, ExecWait will show a command window. You could use nsExec::Exec instead to hide it, and then display a status message with the Banner plugin.

-Stu


Thanks for your response. First, i'll answer your questions:

Yes, I want this to execute under a command prompt. The Cscript exe should be in the system PATH var, so a relative path should be ok. As I said, I run other cscripts in this installer in the same way (no path specified) and they work. I've tried speccing an absolute path for the textfile, as well as the relative one shown in my post, and neither work. I'm not worried about showing the command window, as it's only visible for a half second (or so).

Your example didn't work. It simply opened a command window at the specified path, and waited for input. The installer only continued once I typed 'exit'.

It seems that my problem is related with sending the output to a textfile using the '>' character.

Still confused... but thanks for your response.


Add /C after $R0 in Afrow's example and it should work. If it doesn't, search the forum for examples. Try searching for 'MySQL'.


That worked
Thanks. Your suggestion worked. I added the /C to the execwait line and it works as I'd expect it to.

Why does the /C make it work? I looked in the NSIS docs and can't figure it out. Am I modifying the execwait command with the /C or something else?

Thanks again,
- Greg


/C does not modify ExecWait but COMSPEC.
Type cmd /? or command /? at the console to get help...