tags:

views:

66

answers:

2
+2  A: 

I have done this using an exec extension very successfully

This is the syntax:

  SetOutPath $INSTDIR\${APPLICATION_DIR}
    ExpandEnvStrings $0 %COMSPEC%
    nsExec::ExecToStack '"C:\path-tobatch-file\commands.bat"'

Here is a link to the NSIS Wiki http://nsis.sourceforge.net/Docs/nsExec/nsExec.txt

DBQ
Just to clarify a bit. Batch files need to be run via command processor: `cmd /c batch_file.bat` instead of just `batch_file.bat`. One can get path to `cmd` from %COMSPEC%.
atzz
That worked great, however, is there a way to set it so that the console will display while the batch file is executing? The batch file does a copy/move of a decently large number of files and I don't want the user to think that it's not doing anything when in reality it is.
Nedloh
To display the output, just a straight Exec will display the Cmd Window:Exec '"$0" /C "C:\Path-to-batch\commands.bat"'
DBQ
@DBQ: Hmmm having issues with that, This should work right Exec '"$0" /C "$INSTDIR\batch.bat" "$INSTDIR" "$DATA_FOLDER"' as long as I did the SetOutPath and ExpandEnvStrings
Nedloh
Don't know for sure (Have not used that way before), but direct path to the exec definitely works.
DBQ
AS I updated above, NSIS Exec[Wait] call does not like .bat file for some reason. I changed it to a .cmd extension and my original attempt worked just fine.
Nedloh
@Nedloh, thanks just missed the Update above before my response.
DBQ
+2  A: 

Exec[Wait] needs proper quoting:

ExpandEnvStrings $0 %COMSPEC%
ExecWait '"$0" /C "c:\path\to\batch.cmd" "quoted param" normalparam "c:\last param"'
Anders
ignore all of this, see question for what I found.
Nedloh