我的Windows批处理说:“此时72意外。”

时间:2017-02-22 07:59:45

标签: windows batch-file cmd

下面的批处理文件,为给定的参数列表创建一个.avs文件,然后运行一个程序,该程序将此.avs文件作为参数,并在for循环中多次执行。

但是当我运行我的批处理文件时,它会打印72 is unexpected at this time.72是其中一个参数的值。未创建.avs文件,并且不执行该程序。

我的批处理文件及其在REM @echo off命令提示符下的输出如下所示。

我的批处理文件:

REM @echo off

set RawSource26=C:\_rawsource26\RawSource26.dll
set avsFile=.\temporary.avs
set avs2yuv=C:\_avs2yuv\avs2yuv.exe

set video=balloons
set views=^
1 ^
2 ^
3 ^
4 ^
5
set rates=^
1Mbps ^
2Mbps ^
3Mbps ^
4Mbps ^
5Mbps
set width=1024
set height=768
set cropLeft=72
set cropTop=0
set cropRight=0
set cropBottom=0

(for %%v in (%views%) do (
  @echo. 2> %avsFile%
  @echo LoadPlugin("%RawSource26%") >> %avsFile%
  @echo Crop(RawSource(".\renderOut\%video%_%%v_synth.yuv", %width%, %height%, "i420"), %cropLeft%, %cropTop%, %cropRight%, %cropBottom%) >> %avsFile%
  %avs2yuv% %avsFile% -raw -o .\avsOut\%video%_%%v_synth_avs.yuv
  (for %%r in (%rates%) do (
    @echo. 2> %avsFile%
    @echo LoadPlugin("%RawSource26%") >> %avsFile%
    @echo Crop(RawSource(".\renderOut\%video%_%%v_%%r_synth.yuv", %width%, %height%, "i420"), %cropLeft%, %cropTop%, %cropRight%, %cropBottom%) >> %avsFile%
    %avs2yuv% %avsFile% -raw -o .\avsOut\%video%_%%v_%%r_synth_avs.yuv
))))

REM del %avsFile%

我的命令提示符:

C:\SAFAS\folder02>avs.bat

C:\SAFAS\folder02>REM @echo off

C:\SAFAS\folder02>set RawSource26=C:\_rawsource26\RawSource26.dll

C:\SAFAS\folder02>set avsFile=.\temporary.avs

C:\SAFAS\folder02>set avs2yuv=C:\_avs2yuv\avs2yuv.exe

C:\SAFAS\folder02>set video=balloons

C:\SAFAS\folder02>set views=1 2 3 4 5

C:\SAFAS\folder02>set rates=1Mbps 2Mbps 3Mbps 4Mbps 5Mbps

C:\SAFAS\folder02>set width=1024

C:\SAFAS\folder02>set height=768

C:\SAFAS\folder02>set cropLeft=72

C:\SAFAS\folder02>set cropTop=0

C:\SAFAS\folder02>set cropRight=0

C:\SAFAS\folder02>set cropBottom=0
72 was unexpected at this time.
C:\SAFAS\folder02>  @echo Crop(RawSource(".\renderOut\balloons_%v_synth.yuv", 1024, 768, "i420"), 72, 0, 0, 0) >> .\temporary.avs
C:\SAFAS\folder02>

1 个答案:

答案 0 :(得分:2)

你的循环中的)实际上不是"关闭"但部分echo es需要被"逃脱" - 然后用^)替换,否则批量取消未转义 - )close of block