View Full Version : Is it possible for a macro to wait for a CMD.EXE to finish?

August 23rd, 2005, 09:00 AM
I am trying to create a Girder 4 macro using the GUI that runs several actions and then reboots the PC.

Most of the actions are windows apps (like "MC11.exe /close") where the next step in the macro waits until the command completes, but one action is a run.bat that reloads my TV EPG data using a Java script (and needs to run in a cmd.exe window).

With the .bat file the macro doesn't wait until the cmd.exe windows closes, but continues on and ends up rebooting the PC before the EPG update has finished.

Is there a way of getting the macro to not contimue until the cmd.exe windows has closed?


August 23rd, 2005, 09:18 AM
how are you running the .bat file?

August 23rd, 2005, 10:02 AM
Hi Mike,

I'm adding the OS action "File Execute" and putting the run.bat in the command line.


August 23rd, 2005, 10:29 AM
I thought .bat files run sequentially...? does cmd.exe from a bat do something different?

August 23rd, 2005, 11:08 AM
I'm not calling cmd.exe from run.bat, my run.bat is just one line:

java -jar epgupdate.jar 7

When I call the batch file from the File Execute action a CMD.EXE box comes up and the batch file calling the java app runs in this.

The problem is as soon as the box comes up, the macro continues processing rather than waiting for the CMD.EXE to complete.

I have added my gml file for you to see what I'm doing, just look at the Update Webscheduler action under the Scheduled Actions Group.

You can test this by just changing the path to run.bat to somewhere local and have run.bat with just a"Pause" line in it. If you put a File Execute "calc.exe" after the webscheduler action the macro will continue on and run calc.exe even though run.bat is sitting at a pause and thus hasn't finished.


August 23rd, 2005, 11:11 AM
can you try using a script command and type in

os.execute ("c:\\path\\file.bat")

August 23rd, 2005, 07:43 PM
Easy when you know how.

That works as expected, the macro waits for the os.execute command to complete before it continues.

thanks Mike.

It would be good if the File Execute action worked the same way, but maybe it's not possible.