Archive: Creating files with batch scripts


Creating files with batch scripts
Hello everybody,

I was having so many troubles reading the exit codes from my batch scripts that I decided to go a different way. I changed the scripts so they now make a dummy text file (using echo and redirect ">") if they ran successfully and don't make the file if they had an error. In the installer / uninstaller I want to just test for the presence of the file.

The scripts will create the files fine when I run them from the command line but don't create the file when I call them from the installer. Anybody have any thoughts about why this is happening? Or suggestions to get the files written. I am not an expert in either batch or NSIS so there could be any number of things wrong.

Thanks


Because you must use the command line processor - cmd.exe or command.com. It's the only process that parses input/output redirection. When normally creating processes on Windows with CreateProcess, those won't work and will be considered part of the arguments.


I changed the scripts from .bat to .cmd to ensure they were run with cmd.exe, and I am using ExecWait to call the scripts so I think I am avoiding the CreateProcess problems that occur with !execute and !system. Is there something else that I am missing?


!execute and !system are compile time commands. They won't cause the script to run on the user's system.