你必须使用*
而不是*.*
,否则它就会搜索包含一个圆点*
和*.
和*.*
之间的几个例子.
更新每一个文件:
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