Arush Agarampur
Arush Agarampur

Reputation: 117

Start a batch file in a certain location

I want to start a batch file in a certain location. I tried start /d C:\Windows C:\Windows\branding\readWin..bat The batch file which launches this in on my desktop. Any way to do this?

Thanks.

Upvotes: 0

Views: 1962

Answers (2)

Compo
Compo

Reputation: 38589

I'm not sure exactly what you mean. You shouldn't need to change the current/start-in directory before invoking a script. If that script needs to define its working directory it should do so within.

If that's the case then just enter the full or relative batch file name:

"C:\Windows\branding\readWin..bat"

If the batch file you're wanting to invoke does not define its own current directory and you feel it's necessary then you could be sure by defining it yourself first:

CD /D "C:\Windows"

Or:

PushD "C:\Windows"

After that just run your batch file using its full or relative path as previously mentioned.

Upvotes: 1

phandolin
phandolin

Reputation: 115

Are you running this from command prompt?

start /d "path" file.bat

The quotes around the file path are important, and just the file name follows the path.

Upvotes: 0

Related Questions