Archive: Creating installer through a batch file


Creating installer through a batch file
Okay I am attempting to make a batch file to compile my program and make the installer all at once and its working.

However I'm trying to make it more system independent so that if they happen to have NSIS installed in a different drive than C it will use that.

this is the code I'm using to check for it.

@echo Looking for NullSoft Installer
set NSDIR=
if exist "c:\program files\NSIS\makensis.exe" set NSDIR=c:\program files\NSIS
if exist "d:\program files\NSIS\makensis.exe" set NSDIR=d:\program files\NSIS
if exist "e:\program files\NSIS\makensis.exe" set NSDIR=e:\program files\NSIS
if exist "f:\program files\NSIS\makensis.exe" set NSDIR=f:\program files\NSIS

if NOT "%NSDIR%" == "" goto FoundNS

@echo Can not find NullSoft Installer Directory!


yes I know that if they put it in a completely different dir then it won't work but this should get most people that will be using this batch file.

However I just get
Looking for NullSoft Installer
The system cannot find the batch label specified - FoundNS
and it quits.

So anyone know how to find the NSIS dir.

Find it in the registry at HKLM\SOFTWARE\NSIS [Default].


Read it from the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\NSIS
I don't know if you'll be able to do that from a batch file without an additional executable that'll read the registry. However, you can use a scripting language like Python or Perl. You can even create a NSIS installer that'll read the registry and execute makensis.exe (see Examples\nsExec\test.nsi).

nevermind I had an error in my batch file had a space in the label.