0

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.

user8128167
  • 5,380
  • 6
  • 53
  • 70

1 Answers1

0

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

user8128167
  • 5,380
  • 6
  • 53
  • 70