开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜