Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

LaunchAppEx


3 replies to this topic

RookieDeveloper

RookieDeveloper
  • Members
  • 14 posts

Posted 25 September 2003 - 15:21

If you want to run a batch (.bat) file you must specify the
command processor (cmd.exe for Windows NT/2000 or command.com
for Windows 9x/Me) in the szProgram parameter. In the szCmdLine
parameter pass "/c " + the path to your .bat file. Sample for IS6:
if ( SYSINFO.WIN9X.bWin9X ) then
szProgram = "command.com";
else
szProgram = "cmd.exe";
szParam = TARGETDIR ^ "YourBatch.bat";
LongPathToQuote(szParam, TRUE);
szParam = "/c " + szParam;
ChangeDirectory(TARGETDIR);
_LaunchAppEx(szProgram, szParam, WAIT, SW_HIDE, -1, nvExitCode);

So what happens to the szCmdLine? There seems to be no place for it if you have to specify the cmd.exe in the first parameter and the .bat location in the 2d parameter. Should szCmdLine be included in szParam?

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 25 September 2003 - 15:40

So you want to pass command line parameters to your .bat file?
I'm not sure, but try to append them to szCmdLine after the patch to yourt .bat. Like this:
szCmdLine = "/c your.bat yourparam";

RookieDeveloper

RookieDeveloper
  • Members
  • 14 posts

Posted 25 September 2003 - 15:55

It seems to be working without specifying cmd.exe.

We aren't supporting anything except for 2K and XP so it looks like the default is cmd.exe where as you would only have to specigy command.exe if it's a 9X PC.

I still need to test on XP and 2003 Server but hopefully it still works.

RookieDeveloper

RookieDeveloper
  • Members
  • 14 posts

Posted 10 November 2003 - 21:13

I've noticed that LaunchAppEx works for 2000 Server but no 2000 Professional. It's not even accessing the .bat file. I'm pretty sure this is because of what's in the readme file pertaining to this:

If you want to run a batch (.bat) file you must specify the
command processor (cmd.exe for Windows NT/2000 or command.com
for Windows 9x/Me) in the szProgram parameter. In the szCmdLine
parameter pass "/c " + the path to your .bat file. Sample for IS6:
if ( SYSINFO.WIN9X.bWin9X ) then
szProgram = "command.com";
else
szProgram = "cmd.exe";
szParam = TARGETDIR ^ "YourBatch.bat";
LongPathToQuote(szParam, TRUE);
szParam = "/c " + szParam;
ChangeDirectory(TARGETDIR);
_LaunchAppEx(szProgram, szParam, WAIT, SW_HIDE, -1, nvExitCode);


This doesn't take in to account that you still need to pass parameters to the .bat file. If you implement what's in this example it says to place the .bat file path in the parameters along with "/c" but, this doesn't leave any place to pass the actuall parameters needed for the .bat file. For some reason this works on 2000 Server without passing the additional parameters.