這應該工作
@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
「MSG *做了」 只執行一次 – Ben
對不起,我錯過了這一要求,上述修正。 – ChrisProsser
它顯示「goto循環」但dosent觸發它 – Ben