Sleeping in a .BAT script
这里有列了两个方法:
1. Ping 实现
@ECHO OFF
rem –#——————————————————————
rem –# Script : sleep.BAT
rem –# Tested : Microsoft Windos XP [Version 5.1.2600]
rem –# Purpose : Sleep for number of seconds
rem –# Every 2 pings to localhost takes about 1 second
rem –#
rem –# Usage : sleep.BAT {# of seconds to sleep}
rem –#——————————————————————
ECHO %TIME%
FOR /l %%a IN (%1,-1,1) do (ECHO 1 >NULL %%as&ping -n 2 -w 1 127.0.0.1>NUL)
ECHO %TIME%
2. VBScript 实现
@echo off
echo Wscript.Sleep WScript.Arguments(0) >%tmp%\delay.vbs
cscript //b //nologo %tmp%\delay.vbs 5000
del %tmp%\delay.vbs > nul
当然你也可以用C自己写个。
参考: http://it.toolbox.com/blogs/database-solutions/sleeping-in-a-bat-script-22111
![[Google]]( http://wifihack.net/blog/wp-content/plugins/easy-adsense-lite/google-light.gif)
Recent Comments