2014-08-27 92 views
0

这就是我所要执行的一些基本的文件操作,但代码cmd提示符只是循环而没有执行任何活动或启动任一程序。Dos批处理文件不执行的语法循环问题

: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 
+0

像这样的热门循环不是一个很好的主意,它会无用地烧掉大量的CPU。也许可以考虑在循环之后插入一个延迟,比如“timeout 10/NOBREAK”等待10秒钟。 – ths 2014-08-27 15:14:31

回答

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 

一般来说有空格的文件/路径必须被引用。

+0

这工作谢谢 – user2218260 2014-09-02 15:24:00