Archive: running .bat file


running .bat file
Hi,

I'm trying to execute a batch file using ExecWait. However, it doesn't appear to be executing. The DOS window flashes, butonly for a second, but the code in the batch file should take at least 10 seconds to execute. What's going on?

Thanks,

Mike


Are you sure it runs in with the current directory it thinks it should run in? The NSIS current directory is $EXEDIR (the installer directory). It currently only changes for RegDLL and UnRegDLL so the DLL's regsitered will find their "friends". You can write CD $INSTDIR to the batch file using NSIS or just convert the batch file commands to NSIS commands.

BTW, if you don't want any window to come up use nsExec.


OK, so I got it to work, sort of. I used the fully qualified name of the batch file instead of the relative name (ie c:\my.bat instead of my.bat). But, now, it will only execute it if I don't pass the batch file any parameters. How can I get it to execute the batch file with parameters?

Thanks!

Mike


yesterday i tested nsexec. Did i something wrong or is nsexec not capable of starting a programm with parameters?


If the executable path has spaces in it you must quote it. For example:

nsExec::ExecToLog '"C:\Program Files\My Program\prog.exe" parm1 parm2 "parm 3 with spaces in it"'

If using a variable such as $INSTDIR for the path of the program it is always a good idea to quote because oyu can never know if the user chose a path with spaces or not.


Thanks for your help, I think I figured out the problem. I was quoting it as '"c:\my.bat" "param1" "param2"'. I changed it to 'c:\my.bat "param1" "param2"' and now it works.

-- Mike


It should also work with the quotes, like kichik said. kichik, is this (another) bug?


No, all of this quoting sutff is a Windows' feature :D