在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
获取文件夹下所有文件信息并保存到当前目录下test.txt中的cmd命令:
保存为test.bat文件,然后双击test.bat后就会在该文件夹目录下生产test.txt,里面会包含所有文件的路径信息。
依然有问题:虽然test.txt文件确实生成了,但是里面的文件信息并不是当前文件夹下的,而是windows\system32下的文件信息,比如:C:\WINDOWS\system32\0409等等 cd /d %~dp0 dir /s /b *.* > test.txt 这样一来就完美解决了此问题,计划任务能被完美执行下来去获取当前文件夹下所有文件信息。 如何使用批处理文件更改当前工作目录 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. |
请发表评论