开发者

Changing the path of a batch file (.bat)

How can we cha开发者_运维知识库nge the path of a batch file (.bat) ?


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.

@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


as in adding a temporary extra path to %PATH%?

try: set path=%PATH%;c:\folder

where c:\folder is what you want to add

if you want a permanent path set use a tool called "setx"

otherwise you could call something directly without using CD etc using something like "c:\folder\program.exe"


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

c:
cd "c:\windows\"


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜