Archive: getting makensis errors and warnings on command line


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?


Just check %ERRORLEVEL% in the batch file to determine if makensis completed (it will be 0 on success).

Stu


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.


Run makensis with /V2 and abort if anything is printed. Only warnings and errors are printed with /V2.


How can I detect this in a batch?


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

Great! That works fine. Thanks a lot for your help!