我很高兴地使用下面的Windows命令批处理.BAT来移动文件,而昨天从一些未知的原因,它停止工作。 该命令批量调用的文件good.txt包含一个JPG文件列表: 123.jpg 456.jpg etc ... 运行此批处理的文件夹包含具有相同名称的.CR2文件。该程序简单地将相应的CR2文件复制到“良好”目录。DOS批处理命令文件 - 迭代处理
你知道它为什么不工作吗?我得到一个不正确的语法错误。
由于
布莱斯
@echo off
setlocal enabledelayedexpansion
call :movetodir Good
goto :end
:movetodir
set textfile=%1.txt
set writetodirectory=%1
md !writetodirectory!
for /f "tokens=* delims= " %%G in (!textfile!) do (
set filejpg=%%G
set fileraw=!filejpg:jpg=CR2!
move !fileraw! "!writetodirectory!"
)
goto :eof
:end
什么改变了?你有没有得到关于语法错误在哪里或什么的信息?你有没有尝试使用'REM'来注释一些代码行,直到你没有得到语法错误? – Steve