2014-08-27 90 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