tags:

views:

64

answers:

4

How can we change the path of a batch file (.bat) ?

A: 

Are you talking about changing the path of a command within the batch file? If yes then pass the path as an argument.

Hope I understood your question.

griegs
+1  A: 

I've got a feeling it is about changing the current working directory.

To do that, use the command cd to change current working directory.

e.g.

@echo off
C:\
cd C:\Windows\System32\

If you change both the current drive and the current directory you'll need the /D switch:

cd /D D:\Foo
thephpdeveloper
I think the 2nd line (c:\) shouldnt have \ at the end if you are trying to switch drives.
fedmich
A: 

Firstly, make sure you change the drivename to. then use cd command

c:
cd "c:\windows\"
fedmich
A: 
cd /d d:\foo

or, if you want to jump back to the source directory

pushd d:\foo

with

popd

you switch back to the directory before the pushd

john_doe