Archive: How to direct output of ExecWait to a file


How to direct output of ExecWait to a file
Having issues with the below line in the script:

ExecWait "set>C:\etc\xyz.conf" $R4

I also tried the below mentioned cmds as an alternative:

ExecWait "set" $R4 (this works)
ExecWait '"set" > C:\etc\xyz.conf' $R4 (this doesn't work)
ExecWait '"set">C:\etc\xyz.conf' $R4 (this doesn't work)

I want to direct the output of ExecWait cmd "set" directly to a file C:\etc\xyz.conf. My question here is tht does the '>' sign work or not..if not is there a way to direct the output to a file other than FileOpen ? Secondly, how do I stop the command window from popping on the screen whenever ExecWait executes a command ?

All comments and help much appreciated.


use the nsExec plugin (\NSIS\Contrib\nsExec\nsExec.txt for more info)


ExpandEnvStrings $0 "%COMSPEC%"
nsExec::Exec '$0 /C set $R4 > C:\etc\xyz.conf'

Try that. You may have to experiment with quotation marks as I don't know how set likes its arguments passed, but that should roughly do it.

This isn't execWaiting which I assume is what you want, but it's the best I found when I tried to do the same. Also, if you want to append to the xyz.conf file rather than replace it, use >> instead of >.

Hope this helps

Rob


Originally posted by RobGrant
This isn't execWaiting which I assume is what you want, but it's the best I found when I tried to do the same.
nsExec does wait actually

Thank You guys for your replies to my post, nsExec thing worked but not to the point, I need to have the return code into $R4, but $R4 is empty after the command is executed.

This is what I used in the script:
nsExec::Exec '$0 /C set $R4 > C:\etc\xyz.conf'
nsExec::Exec '$0 /C "set $R4 > C:\etc\xyz.conf"'
nsExec::Exec '$0 /C "set" $R4 > C:\etc\xyz.conf'

Any ideas as to why this must've happened ?

Thanx Guys !


"If nsExec is unable to execute the process, it will return "error"
on the top of the stack, if the process timed out it will return
"timeout", else it will return the return code from the
executed process."

so i guess you just have to do:
nsExec::Exec ...
pop $R4


Tht worked ! Thank you Anders.