Dos批处理文件无法执行的语法循环问题

时间:2014-08-27 14:42:26

标签: batch-file execution

这就是我尝试执行一些基本文件操作但代码cmd提示只是循环而不执行任何活动或启动任何程序。

:loop
if not exist C:\Scanned\1.pdf GOTO LOOP
if exist C:\Scanned\1.pdf GOTO command
:command
if exist C:\Program Files\Microsoft\outlook.exe START outlook.exe /c /a C:\Scanned\1.pdf MOVE /Y C:\Scanned\1.pdf C:\Recieved
if exist C:\Program Files\"Mozilla Thunderbird"\thunderbird.exe START thunderbird.exe -compose attachment= C:\Scanned\1.pdf MOVE /Y C:\Scanned\1.pdf C:\Recieved
GOTO LOOP

1 个答案:

答案 0 :(得分:0)

:loop
    if not exist "C:\Scanned\1.pdf" GOTO LOOP

    if exist "C:\Program Files\Microsoft\outlook.exe" (
        echo here the outlook sending code
    ) else if exist "C:\Program Files\Mozilla Thunderbird\thunderbird.exe" (
        echo here the thunderbird sending code
    )

    move /y "c:\scanned\1.pdf" "c:\received"
    goto LOOP

作为一般规则,必须引用带空格的文件/路径。