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.
您如何将新更改的目录保存到文件中?我认为这会起作用,但它在同一目录中执行命令:
cd desired_dir && echo foo && echo %CD% > path.txt
cmd中是否有类似“执行此操作。完成后,使用新参数执行此操作”的操作符?
我使用此命令来获取基于 Web 的命令行的目录(使用 php)。我从文件中读取当前路径,执行一些代码并将新路径保存到文件中。
将echo %CD%“锁定”在%CD%解析命令时存在的值。如果您想要“实时”目录,请使用:
echo %CD%
%CD%
cd desired_dir && echo foo && cd > path.txt