Saurabhdv27
Saurabhdv27

Reputation: 39

Run a .exe file from BAT file and wait for the execution before running next set of commands

I have a bat file ready for my GIT integration with Siebel tools. But i need to add a tool execution before GIT checkin So how can i run that tools .exe and then wait for the application to close. And after that continue with git checkin.

Upvotes: 2

Views: 10493

Answers (2)

Moonpie
Moonpie

Reputation: 287

Use call.

Example:

call tools.exe

Good source: https://ss64.com/nt/call.html

From this source:

Syntax

CALL [drive:][path]filename [parameters]
CALL :label [parameters]
CALL internal_cmd

Also from this source:

The Microsoft help for the CALL command rather misleadingly states "Calls one batch program from another without stopping the parent batch program" it is true that the parent does not STOP, but it does PAUSE while the second script runs.


I just wrote a simple .bat file that looks like this:

echo Hello.
call C:\Siebel\Tools\BIN\siebdev.exe /c "C:\Siebel\Tools\bin\enu\tools.cfg"
echo Waiting for close.
pause

When I ran it, it output Hello., then it output the call line and opened my Siebel tools. I "tooled" around in Tools doing some things I normally do for a couple of minutes. All the while the command line window output still only showed the call line. Only after I did a File > Exit from Tools did the batch file output the Waiting for close. line, and then pause.

Upvotes: 1

Werner Henze
Werner Henze

Reputation: 16761

You can use start /wait for that like in

start /wait my.exe

Upvotes: 0

Related Questions