SunToo
21st September 2007 08:25 UTC
getting makensis errors and warnings on command line
Hi,
I want to run makensis.exe within a batch file. Following commands in that batch depends on whether or not errors and warnings occurred. Is it possible to get the number of errors and warnings from makensis?
Afrow UK
21st September 2007 11:11 UTC
Just check %ERRORLEVEL% in the batch file to determine if makensis completed (it will be 0 on success).
Stu
SunToo
21st September 2007 13:03 UTC
Yes, that's right. But it returns 0 if only warnings occurred.
A script that causes warnings may not be a problem for the compiler but could cause the setup to fail. So it's required to detect warnings too.
kichik
21st September 2007 15:33 UTC
Run makensis with /V2 and abort if anything is printed. Only warnings and errors are printed with /V2.
SunToo
25th September 2007 12:59 UTC
How can I detect this in a batch?
kichik
25th September 2007 20:10 UTC
Output the result into a file and then test if it's empty.
@echo off
set PATH=%PATH%;C:\Program Files\NSIS
set OUT=test.nsi.output
makensis.exe /V2 test.nsi > %OUT%
for %%R in (%OUT%) do if not %%~zR equ 0 goto error
rem ...
goto end
:error
echo warnings/errors found!
:end
SunToo
26th September 2007 08:46 UTC
Great! That works fine. Thanks a lot for your help!