通配符匹配两个 "dots" 的文件

Wildcard to match files with two "dots"

这不起作用:

del "folder\*.dll.config"

但是,即使不指定文件夹也能正常工作

cd folder
del "*.dll.config"

为什么?

PS。另外,任何解决方法? (除了提到的那个 - 更改当前目录然后返回)

编辑:我是个白痴,我的代码中有错字,现在投票结束我自己的问题。

您可以使用 pushdpopd 命令,例如:

 pushd folder
 del "*.dll.config"
 popd

这样你就可以移动到所需的位置,删除所有 .dll.config 文件并 return 到以前的位置。

在我的 Windows 10 上,它有效:

C:\>dir folder
Volume in drive C is SYSTEM
Directory of C:\folder

30.03.2017  14.33    <DIR>          .
30.03.2017  14.33    <DIR>          ..
29.03.2017  13.33           549.341 my.dll.config
29.03.2017  13.33           549.341 my.foo.bar
           2 File(s)      1.098.682 bytes
           2 Dir(s) 363.317.178.368 bytes free

C:\>del "folder\*.dll.config"

C:\>dir folder
Volume in drive C is SYSTEM
Directory of C:\folder

30.03.2017  14.33    <DIR>          .
30.03.2017  14.33    <DIR>          ..
29.03.2017  13.33           549.341 my.foo.bar
           1 File(s)        549.341 bytes
           2 Dir(s) 363.317.809.152 bytes free

C:\>

但是,您对上面评论中错误消息的拼写错误让我检查了一些内容。

这可能与您的情况完全无关,但可以肯定的是,如果我拼错了文件夹名称,我得到的正是您提到的错误:

C:\>dir folder
Volume in drive C is SYSTEM
Directory of C:\folder

30.03.2017  14.33    <DIR>          .
30.03.2017  14.33    <DIR>          ..
29.03.2017  13.33           549.341 my.dll.config
29.03.2017  13.33           549.341 my.foo.bar
           2 File(s)      1.098.682 bytes
           2 Dir(s) 363.317.248.000 bytes free

C:\>del "dolder\*.dll.config"
The system cannot find the file specified.

C:\>