Windows批处理更改当前工作路径的BAT

上传:irregular_29401 浏览: 14 推荐: 0 文件:pdf 大小:51.46 KB 上传时间:2021-06-29 23:12:28 版权申诉

保存为test.bat文件,然后双击test.bat后就会在该文件夹目录下生产test.txt,里面会包含所有文件的路径信息。依然有问题:虽然test.txt文件确实生成了,但是里面的文件信息并不是当前文件夹下的,而是windows\system32下的文件信息,比如:C:\WINDOWS\system32\0409等等这样一来就完美解决了此问题,计划任务能被完美执行下来去获取当前文件夹下所有文件信息。I need some help in writing a batch file. I have a path stored in a variable root as follows:. Then I am changing my working directory to this root as follows:. When I execute this batch file from anywhere on the D drive this is done successfully. But when I execute the same batch file from some other drive, cd %root% doesn't work.Is there a way I can get the drive letter from the root variable?I can then change the current directory to this drive first and then cd %root% shall work.

上传资源
用户评论