View Full Version : Batch File on XP doesn't work!

10-09-2003, 07:18 PM
I'm trying to launch a batch file to run on Windows XP but it doesn't work,

LaunchAppAndWait("install.bat","", WAIT);

This doesn't launch the batch file. I'm able to open up the install.bat using OpenFile command and display the command in a dialog.

I've read in previous threads about batch files working on 2000, NT but not on XP. Is this correct, can somebody provide me some answers?


10-10-2003, 09:44 AM
I'm not sure, but you may have to run CMD.EXE, the command processor, and pass it "install.bat" as its command parameter.

You may also have to set the current directory to where install.bat is located.

You will have to watch out for DS9 changing the default directory in LaunchAppAndWait unless you use the option LAAW_OPTION_NO_CHANGEDIRECTORY.

Hope that helps,


10-10-2003, 11:18 AM
Thanks for the reply.

The directory settings is appropriate. I launch cmd.exe and try to launch 'install.bat' file but it doesn't work!

If I copy the same file to a temp folder and execute it, then it works great.

I'm trying to install a tool into c:\Program Files\MyTool and 'install.bat' file is present in MyTool directory.

so from install shield, using LanchAppAndWait, I launch cmd.exe and pass 'install.bat' as the argument. The directory in cmd.exe is set to 'MyTool' and 'dir' command lists my install.bat, when I run to explicitly run install.bat from this directory, it doen't work. While still debugging I created a 'test.bat' and entered some echo commands, this doesn't work either. I copied over the test.bat file to c:\temp and executed the file, it works great.

So, when I'm trying to install the tool, the directory in which these batch files are present doesn't seem to execute!!

Any further clues?


10-10-2003, 11:29 AM
have you tried to ChangeDirectory to the directory the batch file is located in? I've found that to solve some of my LaunchApp issues.

good luck.


10-10-2003, 11:32 AM
Yes. I change directory to the file in which it is located. I even am able to open the file by using OpenFile command and read the contents of the file and display it.

Even launch cmd.exe takes me to the desired directory and I'm able to issue 'dir' command and look into the file. In the same directory if I issue 'install.bat' command, it fails. Copying it to a different directory and calling 'install.bat' suceeds!

This is happening during the product install, so the directory in which I'm trying to launch 'install.bat' is probably still commanded by Installshield!

Not sure what the problem is?

Any help, greatly appreciated.

10-14-2003, 01:33 PM
Hi BB,

I tried this test on an XP system, and it worked:

1. Created an InstallScript project.
2. Added this to the script...

function OnBegin()
// TODO: Perform custom initialization steps, check requirements, etc.
MessageBox("about to run batch", INFORMATION);
LaunchAppAndWait("c:\\install.bat", "", WAIT);
MessageBox("tried to run batch", INFORMATION);

3. Built the project
4. Created a file called install.bat in c:\ with this as its contents:

echo Hi

5. Ran the setup.

Result: It worked.

Can you try that and let us know if it works?


06-24-2004, 07:57 AM
RichAquino -try to do it in some component event and not in OnBegin.I think it would not work.I have a similar problem which appears only if I use LaunchAppAndWait in a component event.If i use it elsewhere it works perfectly.Any idea why?

06-24-2004, 08:35 AM
The LaunchAppAndWait issue occurs in InstallScript functions that are called from the MSI during the MSI portion of the installation. An example is OnInstallFilesAfter...

OnBegin and OnFirstUIBefore/After work fine because they are called from the Installshield engine, not the MSI engine.

Try calling LaunchAppAndWait in WinXP during the OnInstallFilesBefore or After... won't work!

06-24-2004, 08:43 AM
ok,so u think I cannot launch a batch file with LaunchAppAndWait from a feature event?
I have written above component event (as in ISPro) but in DS9 it should be written feature event.

06-29-2004, 10:20 AM
hey guys, Im having the same issue. I need to run a batch file in XP from installScript. the thing is, it works perfectly on win2000 or win98 or event NT ... but not on XP Professional (havent tried server yet).

anyone find the solution to this?