Search code examples
nsis

"Exec" into specific folder


From an NSIS script (located at C:\nsis\ for example), I execute an external program (let's say something.bat) with some paramerters:

Exec '"Z:\draft\something.bat" $param1 $param2'

something.bat is suppoed to rename the directory C:\nsis. My question is, how can I tell Exec to launch something.bat inside Z:\draft\ and not C:\nsis\? Because, it can't rename the directory otherwise.

Thanks.


Solution

  • You can use SetOutPath to set the current working directory. I think that should do what you want.

    In the NSIS documentation you can also see that it uses the variable that SetOutPath sets (which is $OUTDIR) for Exec statements.

    4.9.1.2 Exec

    Exec command
    Execute the specified program and continue immediately. Note that the file specified must exist on the target system, not the compiling system. $OUTDIR is used for the working directory.