Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Windows .cmd ファイル内のディレクトリに cd していますが、このファイルにはさまざまなリターン ポイントがあり、
元のディレクトリを保存せずに元のディレクトリに戻り、スクリプトのすべてのリターンポイントで明示的に元のディレクトリに戻るにはどうすればよいですか。
スコープと関係があると思います....?
PUSHD と POPD を使用します。
C: CD \ PUSHD C:\Windows POPD
別のレベルの間接性を追加するだけです。の代わりにoriginal_script.cmd、これを実行します。
original_script.cmd
PUSHD CALL original_script.cmd POPD