Cpich
Cpich

Reputation: 17

How to execute multiple batch files?

I need to execute several batch files one after another, each .bat executing from a different folder. for example I have the following code:

cd test1
oneup.bat
cd test2
oneup.bat
cd test3
oneup.bat

When I execute that code inside the folder containing test1,2 and 3, It executes the first oneup.bat within the test1 folder but then it stops. How can I make it run as intended?

Upvotes: 0

Views: 665

Answers (2)

cure
cure

Reputation: 2688

cd /d "test1"
call oneup.bat
set a="%cd%"
cd /d "test2"
call "%a%\oneup.bat"
cd /d "test3"
call "%a%\oneup.bat"

this will exec the same batch file in different folders.

Upvotes: 1

npocmaka
npocmaka

Reputation: 57332

cd /d "test1"
call oneup.bat
cd /d "test2"
call oneup.bat
cd /d "test3"
call oneup.bat

Upvotes: 2

Related Questions