Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

How to run a .bat from batch in another folder

Writer Emily Wong

To make this clear:

Folder-structure looks like this: C:\Folder1\Folder2\

Folder1: Has one script that starts multiply script in Folder2.
Folder2: Contains scripts that launch and host servers IN Folder2.

So, I have three .bat scripts in Folder2 that launch an .jar file with the java command.

I want to make them all start at once -> one script in Folder1. This one should start all three batch scripts, in separate windows.(because these are server).

The problem is, all the time I launch one of the .bat scripts from a script in Folder1, Java (I assume) thinks I am in Folder1 and the server, (that should start with the script) in Folder2 , doesn't find config files....

1

1 Answer

To change the working directory you simply use cd and to call batch you use call

So, in the batch in folder1:

cd folder2
call batch1.bat ...

Instead of

call folder2\batch1.bat ...
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy