i am using:
ExpandEnvStrings $0 %COMSPEC%
ExecWait '"$0" /C "c:\path\to\batch.cmd" "quoted param" normalparam "c:\last param"'
To run a batch file from NSIS.
What are my options to know if the batch.cmd failed or succeed?
Is there an way to get CMD errorlevel parameter after the batch call in NSIS?
Thanks
Running batch file from NSIS
6 posts
is seems that when i m running
ExecWait '"$INSTDIR\someprogram.exe"' $0
with a batch file the value $0 is always == 1
ExecWait '"$INSTDIR\someprogram.exe"' $0
with a batch file the value $0 is always == 1
What i meant is actually that the $0 doesn't return the %errorlevel
ExecWait reports the process (cmd.exe for batch files) exit code.
Batch files have broken exit code handling, to fix it, as the LAST line in your batchfile use
Batch files have broken exit code handling, to fix it, as the LAST line in your batchfile use
@%COMSPEC% /C exit %errorlevel% >nulSee also:
Thanks a lot!!!
i will try it, though i found a work around - writing the errorlevel to a file and NSIS read the result.
i will try it, though i found a work around - writing the errorlevel to a file and NSIS read the result.