Starting two exe with one bat file how do i do it?

Hi all,

I was trying to write a bat file that will execute 2 exe. The way i want to do it is i will execute the first exe and do some task. The second exe will only being executed when teh first 1 completed.

How can I write the script in the bat file? Any special commands or any sites to reccomend. Thanks a lot and your help would be appreciated!

IxCraZeeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jhapakCommented:
1. create a file xyz.bat.
2. just enter the name of the file (with complete path if they are not in the same directory)
3. save it
4. execute it, eg. xyz

example:
@echo off (this will not show the commands while executing)
c:\windows\sol.exe
c:\windows\regedit.exe

you can give as many filenames as you want to execute.

Also you can use "Pause" within the batch file. What it simple does is show a line Press any key to continue... and wait for a key hit.

Also visit:
http://gatsby.tafe.tas.edu.au/batch/
0
iamtsubasaCommented:
You can better control your programs execution if you use Windows Scripting Host, which is already installed by default.  The Run() method for instance offers rich options, depending on the integer value you pass in:

0 Hides the window and activates another window.
1 Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.
2 Activates the window and displays it as a minimized window.  
3 Activates the window and displays it as a maximized window.  
4 Displays a window in its most recent size and position. The active window remains active.
5 Activates the window and displays it in its current size and position.
6 Minimizes the specified window and activates the next top-level window in the Z order.
7 Displays the window as a minimized window. The active window remains active.
8 Displays the window in its current state. The active window remains active.
9 Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.
10 Sets the show-state based on the state of the program that started the application.

More information and samples can be found on MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsoriWindowsScriptHost.asp.
0
BryanDohertyCommented:
Use the "start /wait" command.

Example:

@echo off
cls
start /wait prog1.exe
start /wait prog2.exe
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.