你必須使用*
而不是*.*
,否則它就會搜索包含一個圓點*
和*.
和*.*
之間的幾個例子.
更新每一個文件:
copy nul _onefilewithoutext
copy nul _onefilewith.ext
mkdir _oneFolder
dir /b /a-d *.
_onefilewithoutext
Forfiles
命令
forfiles /M *. /C "cmd /C echo @relpath"
Error: File Type "*." not found.
forfiles /M * /C "cmd /C echo @relpath"
".\_onefilewith.ext"
".\_onefilewithoutext"
".\_oneFolder"
forfiles /M *.* /C "cmd /C echo @relpath"
".\_onefilewith.ext"
forfiles /M * /C "cmd /C if @isdir==FALSE echo @relpath"
".\_onefilewith.ext"
".\_onefilewithoutext"
forfiles /M * /C "cmd /C if @isdir==FALSE if @ext==\"\" echo @relpath"
".\_onefilewithoutext"
模式'*'匹配_every_項;也許'* .'可能會工作(但我現在無法測試)... – aschipfl
是的,'* .'是如何顯示沒有擴展名的文件。 – SomethingDark
@SomethingDark也不在'forfiles'情況下。 – Paul