开发者

cd inside a windows cmd, how to get back to original directory?

开发者 https://www.devze.com 2023-02-15 21:57 出处:网络
I am cd ing to a directory inside a windows .cmd file, but this f开发者_如何学运维ile has various return points,

I am cd ing to a directory inside a windows .cmd file, but this f开发者_如何学运维ile has various return points,

how do I make return to the original directory without saving the original directory and returning to it explicitly at every return point in the script.

I think is has something to do with scope....?


Use PUSHD and POPD.

C:
CD \
PUSHD C:\Windows
POPD


Just add another level of indirection. Instead of original_script.cmd, run this:

PUSHD
CALL original_script.cmd
POPD
0

精彩评论

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