2014-02-13 89 views
0

我想每60秒了一封郵件彈出作爲一個提醒跳隙每60秒 - 在cmd

我試圖

@echo off 
:loop 
msg * Some text 
@ping -n 60 -w 1000 0.0.0.1 > NUL 
goto loop 

@echo off 
:loop 
msg * Some text 
timeout /t 60 
goto loop 

@echo off 
:loop 
msg * Some text 
ping -n 60 localhost >nul 
goto loop 

回答

0

這應該工作

@echo off 

set /a secs=60 
set /a ms=%secs%*1000 

:loop 
echo Process will wait for %secs% seconds and then continue... 
ping 1.1.1.1 -n 1 -w %ms% > nul 
msg * done 
goto loop 

或使通用等待x秒的腳本以秒數作爲參數調用以下版本,爲此,您可以在控制腳本中執行msg和循環:

@echo off 
rem call with # of seconds to wait 

set /a secs=%1 
set /a ms=%secs%*1000 
echo Process will wait for %secs% seconds and then continue... 
ping 1.1.1.1 -n 1 -w %ms% > nul 
echo. 
::msg * done 
exit 

以後添加

@echo off 
rem call with # of seconds to wait 

:loop 
set /a secs=%1 
set /a ms=%secs%*1000 
echo Process will wait for %secs% seconds and then continue... 
ping 1.1.1.1 -n 1 -w %ms% > nul 
echo. 
msg * done 
goto loop 
exit 
+0

「MSG *做了」 只執行一次 – Ben

+0

對不起,我錯過了這一要求,上述修正。 – ChrisProsser

+0

它顯示「goto循環」但dosent觸發它 – Ben