JiveMiguel
23rd August 2004 00:26 UTC
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!
Afrow UK
23rd August 2004 01:01 UTC
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
JiveMiguel
23rd August 2004 01:19 UTC
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.
kichik
26th August 2004 21:25 UTC
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'.
JiveMiguel
26th August 2004 21:52 UTC
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
niteflyer
27th August 2004 16:39 UTC
/C does not modify ExecWait but COMSPEC.
Type cmd /? or command /? at the console to get help...