Note that there are some explanatory texts on larger screens.

plurals
  1. POExecuting Batch File in NSIS installer
    primarykey
    data
    text
    <p>I have a batch file that I need to run within my NSIS installer. It must run after all the files have been extracted, (I suppose this is obvious, otherwise the batch file wouldn't exist yet).</p> <p>I tried to use MUI_PAGE_CUSTOMFUNCTION_PRE with the finish page in order to run it but when it gets to that portion of the script it appears that it skips right over it. Below is how I invoke it.</p> <pre><code>;;Finish Page !define MUI_PAGE_CUSTOMFUNCTION_PRE Done !insertmacro MUI_PAGE_FINISH Function Done ExecWait '"$INSTDIR\BatchFile" "$INSTDIR" "$DATA_FOLDER"' FunctionEnd </code></pre> <p>Thanks in advance for your help.</p> <p><strong><em>UPDATE</em></strong></p> <p>I have now tried using the following: </p> <pre><code>ExpandEnvStrings $0 %COMSPEC% ExecWait '"$0" /C "$INSTDIR\batch.bat" "$INSTDIR" "$DATA_FOLDER"' </code></pre> <p>This did not work, so I took out the /C to see what the cmd prompt was saying (it is popping up, but closing immediately) and it seems as though it executes cmd.exe but that's it, it doesn't complete the rest of the execute.</p> <p><strong><em>UPDATE #2</em></strong></p> <p>The core knowledge that led to me getting it to work can be found here:</p> <p><a href="https://stackoverflow.com/questions/148968/windows-batch-files-bat-vs-cmd">Windows batch files: .bat vs .cmd?</a></p> <p>For whatever reason .bat files do not agree with ExecWait.</p> <p>In the end:</p> <pre><code>ExecWait '"$INSTDIR\BatchFile.cmd" "$INSTDIR" "$DATA_FOLDER"' </code></pre> <p>Worked just fine.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload