Skip to content
⌘ NSIS Forum Archive

getting makensis errors and warnings on command line

7 posts

SunToo#

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#
Just check %ERRORLEVEL% in the batch file to determine if makensis completed (it will be 0 on success).

Stu
SunToo#
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#
Run makensis with /V2 and abort if anything is printed. Only warnings and errors are printed with /V2.
kichik#
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