Reputation: 7676
Please note that I am attempting to create a data file as part of my installation script. Here is what I am using:
# Create config.dat based on user`s previous selection
nsExec::ExecToStack '"$SYSDIR\cmd.exe" @echo ServerPort = 2003 > $INSTDIR\config.dat'
Pop $0 # return value/error/timeout
Pop $1 # printed text, up to ${NSIS_MAX_STRLEN}
DetailPrint '$SYSDIR\cmd.exe "@echo ServerPort = 2003 > $INSTDIR\config.dat" printed: $1'
DetailPrint ""
DetailPrint " Return value: $0"
DetailPrint ""
When I run the script, the above returns a 0, so I think it should have worked but when I check the installation directory I see that no config.dat file has been created.
Also, I have tried this command,
nsExec::ExecToStack '@echo ServerPort = 2003 > $INSTDIR\config.dat'
But when I use it the display prints:
Return value: error
Here are websites I have looked at but it is still not clear to me how to get nsExec working.
Does anyone have any suggestions? TIA.
Upvotes: 3
Views: 2077
Reputation: 7676
Please note that I have found the issue. I thought nsExec
mainly worked with the command line, but you have to start with cmd:
nsExec::ExecToStack 'cmd /c "@echo ServerPort = 2003 > config.dat"'
For details please see:
Execute Command-Line Command from NSIS
Upvotes: 3