command-linensis

Using NSIS Command Line for compile scripts


I have a doubt about the usage of the NSIS scripts compilation. We have two ways to compile a nsis script: using the NSIS app (Where we can compile, test and run our script) and using the command line makensis file.nsi in the terminal.

When we run the command line for compile the script, is he make the same processes of the NSIS app? Because, for instance, when we execute a jar using the command java -jar file.jar not always will execute all content in your file.

I know that NSIS app can compile correctly all content of my scripts, but the command line can do the same without errors?

I tried use the command makensis /V4 /INPUTCHARSET UTF8 file.nsi > '.\logs\logs_file.txt' for testing, with this I can see all the logs and what was executed during the compilation of the script, but I still don't know if it's ideal


Solution

  • There is only one NSIS compiler, makensis.exe.

    The GUI app makensisW.exe just executes makensis.exe when you press compile.

    It formats the command line as follows (C++):

    wsprintf(
      g_sdata.compile_command,
      _T("%s /V%u %s %s /NOTIFYHWND %d %s -- \"%s\""),
      EXENAME,
      g_sdata.verbosity,
      compressor,
      symbols,
      g_sdata.hwnd,
      args,
      g_sdata.script
    );
    

    compressor and symbols can be empty strings. /NOTIFYHWND %d is a parameter that allows the compiler to tell the GUI app window about errors, warnings and the OutFile name so it can run the installer.