簡體   English   中英

批處理和cmd.exe中的變量和通配符

[英]Variables and wildcards in batch and cmd.exe

我正在嘗試在所有驅動器中搜索文件名。 單獨使用dir命令時,一切順利:

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.

有人能幫我嗎?

感謝您的所有幫助,以及其他腳本的好主意。

我在尋找的答案在哪里:

C:\>FOR /F "skip=1 delims= " %x in ('wmic logicaldisk get caption') do @where /R %x *blabla* 2>NULL
C:\Users\Administrator\Desktop\blabla.txt

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM