0

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?

1

2 Answers 2

2
cd /d "test1"
call oneup.bat
cd /d "test2"
call oneup.bat
cd /d "test3"
call oneup.bat
Sign up to request clarification or add additional context in comments.

Comments

1
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.

3 Comments

This needs the call keyword or it will stop after the 2nd line.
Thanks guys, but still not working. It stops after it executes the first oneup.bat file
inside the test1 folder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.