[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 336
  • Last Modified:

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!

0
IxCraZee
Asked:
IxCraZee
1 Solution
 
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now