1
我想对图像中的某些东西在扩展名中定义变量。 下面的脚本运行良好:Windows批处理脚本 - 如何使用定义的扩展名筛选文件
set AllowExt="jpg png bmp"
forfiles /p D:\Pictures /m *.* /c "cmd /c if not %AllowExt:jpg=% == %AllowExt% echo @file
但下面的脚本抛出错误
set AllowExt="jpg png bmp"
forfiles /p D:\Pictures /m *.* /c "cmd /c if not %AllowExt:@ext=% == %AllowExt% echo @file"
ERROR:无效的参数/选项 - 'PNG'。 输入“FORFILES /?”供使用。
修正如下,它运行良好。 组AllowExt = .JPG .PNG .BMP 用于%%一个在(%AllowExt%)做( FORFILES/P d:\图片/米* %%的A/C “CMD/C回波@file” ) –
@JinHo你说得对,应该没有双引号:) – Endoro