Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 批处理通配符扩展_Batch File_Wildcard - Fatal编程技术网

Batch file 批处理通配符扩展

Batch file 批处理通配符扩展,batch-file,wildcard,Batch File,Wildcard,所以from告诉我 del /S moc_*.cxx call is also deleting moc_foo.cxx_parameters 如果我不知道foo的长度,在windows中有没有办法只删除.cxx文件 编辑 我发现一个“等价”的电话是 如果找不到文件,请安静地执行此操作 forfiles /S /m *.cxx /c "cmd /c del @file" 2> nul 多么糟糕的设计 对于(moc.*.cxx)中的%i,如果/i“%~xi”==”.cxx“ECHO de

所以from告诉我

del /S moc_*.cxx call is also deleting moc_foo.cxx_parameters
如果我不知道foo的长度,在windows中有没有办法只删除.cxx文件

编辑 我发现一个“等价”的电话是

如果找不到文件,请安静地执行此操作

forfiles /S /m *.cxx /c "cmd /c del @file" 2> nul
多么糟糕的设计

对于(moc.*.cxx)中的%i,如果/i“%~xi”==”.cxx“ECHO del”%i,则执行该操作


应仅选择要删除的.cxx文件。删除
echo
关键字以在验证后执行删除。将
%
改为
%
以在批处理文件中使用

如果/i“%~xi”==”.cxx”
在您的帖子中添加/i,则可能需要在
中添加/i。del命令根据您的文件名运行,我也读取了您的其他帖子,但dir命令也按预期工作,它与“file.txt”匹配,但与“file.txtf”不匹配。您正在使用Windows XP或更早版本?*模式在服务器上按预期工作win7@ElektroHacker-链接问题中的答案在解释一个非常真实的问题方面做得很差。带有通配符的文件掩码可能与完整、长名称或短8.3名称匹配。@ElektroHacker它在win7上的功能与预期不同,它的功能是相同的……通配符基本上并不意味着“在通配符所在的位置将其他字符与尽可能多的字符匹配”。它的意思是“我想找到这个文件”和“Windows可以帮我猜文件名”,正如我所说,这是一个糟糕的设计。
forfiles /S /m *.cxx /c "cmd /c del @file" 2> nul