语法命令错误

语法命令错误

每次运行这个批处理文件时,总是会出现错误“命令语法不正确”。我似乎无法弄清楚脚本的哪一部分导致了这个错误。有什么想法吗?

rem Process all *.tif files in input path
pushd "%in_path%"
for %%a in (*.tif) do (
   set "fileName=%%a"
   rem If the YearDay in this file is the same of previous one
   if "!fileName:~1,7!" equ "!yearDay!" (
      rem Join this filename to previous list
      set "fileList=!fileList!!fileName! "
      set /A numFiles+=1
   ) else (
      rem Merge the files in the list if there are more than 3, in the out_path leaving only TYYYYDDD.L2_LAC.Tera.tif
      if !numFiles! gtr 3 (
         gdal_merge.py -n 0 -a_nodata -32767 -of GTiff -o %out_path%\T!yearDay!.L2_LAC.Tera.tif !fileList!
         rem Move processed files to a different directory
         set "fileList=!fileList:~0,-1!"
         move !fileList: =,! "%proc_path%"
      )
      rem And start a new YearDay and fileList
      set "yearDay=!fileName:~1,7!"
      set "fileList=!fileName! "
      set numFiles=1
   )
)
popd

答案1

在朋友的帮助下解决了这个问题。我刚刚替换了脚本的这一部分,

 set "fileList=!fileList:~0,-1!"
 move !fileList: =,! "%proc_path%"

有了这个,

for %%a in (!fileList!) do move %%a "%proc_path%"  >nul

相关内容