Link to home
Start Free TrialLog in
Avatar of holemania
holemania

asked on

Dos command to wait for another bat file to complete before continuing

Hello experts,

I have 2 batch file.  One fire first and then call another batch file to run.  How would I set it so that it would wait until that 2nd batch file finish before continuing?

Batch File 1:
@echo off
Start G:\MappedDrv.bat
Start G:\Autocad.exe
Exit

Batch File 2:
@echo off
net use g: /delete
net use g: \\server1\data\eng
exit

Not that batch 2 does some processing after mapping the drive by copying some user setting files over so can take a while.  Issue that I am running into is that there are open files.  So is there a way to set it so that first bat file will call the 2nd one to complete running and then continue on?
Avatar of Ernie Beek
Ernie Beek
Flag of Netherlands image

Use the start command. When invoked, it will wait untill the called batch is finished.
SOLUTION
Avatar of Ernie Beek
Ernie Beek
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of holemania
holemania

ASKER

Thanks.