0
我试图寻找所有驱动器的文件名。当单独使用dir
命令一切顺利:变量和通配符批量和cmd.exe的
C:\>dir /s C:\*blabla*
Volume in drive C has no label.
Volume Serial Number is 2AB1-3FBD
Directory of C:\Users\Administrator\Desktop
02/08/2016 11:21 0 blabla.txt
1 File(s) 0 bytes
Total Files Listed:
1 File(s) 0 bytes
0 Dir(s) 28?369?825?792 bytes free
但在使用上的循环,当它失败:
FOR /F "skip=1 delims=" %x in ('wmic logicaldisk get caption') do dir /s %x*blabla*
*blabla* Administrator\Desktop>dir /s A:
The device is not ready.
*blabla* Administrator\Desktop>dir /s C:
Volume in drive C has no label.
有人能帮助我吗?
我似乎无法复制此。我是否正确读取,调用'dir/s C:'时出现的唯一行是“驱动器C中的卷没有标签”,还是有更多? – SomethingDark
尝试_FOR/F“skip = 1 delims =”%x in('wmic logicaldisk get caption')do dir/s%x \\ * blabla * _。 _delims_有一个空格作为附加标记。也是我在_%×\\ *布拉布拉* _添加一个反斜杠用于_logicaldisk获得图片说明只返回DRIVENAME和结肠,而不是反斜杠 – elzooilogico
这是更好的'FOR/F “跳过= 1个delims =” %在('WMIC逻辑磁盘X获得标题 ')做回声(%X |找到 “:”> NUL && DIR/S%X \ *布拉布拉*' – elzooilogico