Nutrox
13th November 2005 21:53 UTC
Compile NSI file from BAT file
Hi guys.
Normally when I want to compile a NSI file I can right-click on it and select "Compile NSIS Script" from the context menu.
Is it possible to compile a NSI from a BAT file?
I'm not being lazy or anything, it's just that I have a folder that contains quite a lot of NSI files, and it makes more sense to get a BAT file to compile them all rather than me having to right-click on all of them.
Thanks,
Si ++
Instructor
13th November 2005 22:22 UTC
makensis.exe "C:\myscript.nsi"
Instructor
13th November 2005 22:47 UTC
You can try:
Script:
Name "CompileNSI"
OutFile "CompileNSI.exe"
ShowInstDetails show
!include "FileFunc.nsh"
!insertmacro Locate
!insertmacro GetParameters
Section
ReadRegStr $R0 HKLM "SOFTWARE\NSIS" ""
IfErrors error
StrCpy $R1 0
StrCpy $R2 0
${GetParameters} $0
${Locate} "$0" "/L=F /M=*.nsi" LocateCallback
IfErrors error
DetailPrint ""
DetailPrint "$R1 from $R2 files compile with errors"
goto end
error:
MessageBox MB_OK "Error"
end:
SectionEnd
Function LocateCallback
nsExec::ExecToLog '"$R0\makensis.exe" "$R9"'
Pop $0
StrCmp $0 0 +2
IntOp $R1 $R1 + 1
IntOp $R2 $R2 + 1
Push 0
FunctionEnd
CompileNSI.bat:
@ECHO OFF
"CompileNSI.exe" C:\Path to yours scripts
CLS
Nutrox
13th November 2005 23:12 UTC
Thanks, Instructor. I will give that a try.