greenstars
18th January 2003 14:25 UTC
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
kichik
18th January 2003 14:36 UTC
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.
greenstars
19th January 2003 22:55 UTC
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
JaqDraco
20th January 2003 08:39 UTC
yesterday i tested nsexec. Did i something wrong or is nsexec not capable of starting a programm with parameters?
kichik
20th January 2003 11:35 UTC
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.
greenstars
20th January 2003 15:36 UTC
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
virtlink
20th January 2003 16:04 UTC
It should also work with the quotes, like kichik said. kichik, is this (another) bug?
kichik
20th January 2003 16:08 UTC
No, all of this quoting sutff is a Windows' feature :D