开发者

How to return to current working directory after cdin'g out in a batch file?

开发者 https://www.devze.com 2023-03-30 16:14 出处:网络
I have a batch file and I want to do the following... cd C:\\some\\directory some开发者_如何转开发_command.cmd

I have a batch file and I want to do the following...

cd C:\some\directory
some开发者_如何转开发_command.cmd
# return to the directory I started in here
python some_script.py

As you can see in the commented line, I need some way to return to the directory I started in. How can I do this?


You can try pushd and popd commands see http://en.wikipedia.org/wiki/Pushd_and_popd


set OLDDIR=%CD% rem current directory

rem your script 

chdir /d %OLDDIR% rem go to OLDDIR
0

精彩评论

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

关注公众号