Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running .bat files within .bat file 2

Status
Not open for further replies.

EdRev

Programmer
Aug 29, 2000
510
US
I have this batchfile that I need to run.

batch1.bat
cd \Program Files
batch2.bat

For testing, I string a couple of vbs files in batch1.bat and batch2.bat. Separately, both batch files work.
But when I string the two bat files as above, batch1 run but not batch2.
I tried

cd \Program Files
batch2.bat
cd \
batch1.bat

batch2 run but not batch1

Seemed like I could not cd from here.

Any help will be greatly appreciated.
 
Why dont you do like this..

A third bat file named batch3.bat

Code:
start /min \\computername\searchstring\batch1.bat

start /min \\computername\searchstring\batch2.bat

You colud insted of /min use /max or /wait etx..
 
A batch file will not return to the calling batch file if invoked the way you've done it. If you want it to return, use call. eg
Code:
cd \Program Files
[COLOR=RED]call[/COLOR] batch2.bat
cd \
[COLOR=RED]call[/COLOR] batch1.bat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top