timeout /t 5 /nobreak >nul 2>nul
或中亩
waitfor TEST /t 5 >nul 2>nul
如果是vista以下的系统,那就用ping命令实现吧棚培仔!(缺点:精度不高)
ping 127.0.0.1 -n "5">nul
CMD,DOS批处理延时肢绝手4种可行方法 (以下所有的程序均以等待/延迟/暂停2秒示例)1、比较传统的设计思路,利用for解析变量%time%并存为一个时间点,再利用set计算两个时间点的时间差,最后用if判断时间差是否宏雹达到设定的暂停时间。时间精度为0.01秒,适用平台为WinNT/2K/XP/2003。@echo offsetlocal enableextensionsecho %time%call :ProcDelay 200echo %time%goto :EOF:ProcDelay delayMSec_setlocal enableextensionsfor /f "tokens=1-4 delims=:. " %%h in ("%time%") do set start_=%%h%%i%%j%%k:_procwaitloopfor /f "tokens=1-4 delims=:. " %%h in ("%time%") do set now_=%%h%%i%%j%%kset /a diff_=%now_%-%start_%if %diff_% LSS %1 goto _procwaitloopendlocal &goto :EOF2、使用Windows的VBS脚本中的sleep函数,可历嫌以动态创建这个VBS脚本,然后用Windows脚本宿主的命令行版本调用它。时间精度为0.001秒,使用平台为Win9x/WinNT系列。@echo off &setlocal enableextensions enabledelayedexpansionecho WScript.Sleep 2000 >%temp%\tmp$$$.vbsecho %time%cscript //nologo %temp%\tmp$$$.vbsecho %time%for %%f in (%temp%\tmp$$$.vbs) do if exist %%f del %%fendlocal &goto :EOF3、如果你的Windows系统中正常安装了网卡的TCP/IP协议,也可以使用ping定时发送测试包,以此达到暂停一定时间的目的;-n后的数字是发送包的数目,根据植树原则,为暂停秒数加一,此法每秒有0.5%的偏差。时间精度为1秒,使用平台为Win9x/WinNT系列。ping -n 3 127.0.0.1>nul4、德国人Herbert Kleebauer给出了一个通用方案,通过间接产生一个exe程序来实现延迟,这个程序分为DOS和Win两个模块。延迟精度为0.001秒,适用平台为MS-DOS/Win9x/WinNT。@echo offecho q | debug>nulecho Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>sleep.comecho 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU WwX0GwUY WvovBX2Gv0ExGIuht6>>sleep.comecho T}{z~~@GwkBG@OEKcUt`~}@MqqBsy?seHB~_Phxr?@zAB`LrPEyoDt@Cj?>>sleep.comecho pky_jN@QEKpEt@ij?jySjN@REKpEt@jj?jyGjN@SEKkjtlGuNw?p@pjirz>>sleep.comecho LFvAURQ?OYLTQ@@?~QCoOL~RDU@?aU?@{QOq?@}IKuNWpe~FpeQFwH?Vkk>>sleep.comecho _GSqoCvH{OjeOSeIQRmA@KnEFB?p??mcjNne~B?M??QhetLBgBPHexh@e=>>sleep.com</p><p>echo EsOgwTLbLK?sFU`?LDOD@@K@xO?SUudA?_FKJ@N?KD@?UA??O}HCQOQ??R>>sleep.comecho _OQOL?CLA?CEU?_FU?UAQ?UBD?LOC?ORO?UOL?UOD?OOI?UgL?LOR@YUO?>>sleep.comecho dsmSQswDOR[BQAQ?LUA?_L_oUNUScLOOuLOODUO?UOE@OwH?UOQ?DJTSDM>>sleep.comecho QTqrK@kcmSULkPcLOOuLOOFUO?hwDTqOsTdbnTQrrDsdFTlnBTm`lThKcT>>sleep.comecho @dmTkRQSoddTT~?K?OCOQp?o??Gds?wOw?PGAtaCHQvNntQv_w?A?it\EH>>sleep.comecho {zpQpKGk?Jbs?FqokOH{T?jPvP@IQBDFAN?OHROL?Kj??pd~aN?OHROd?G>>sleep.comecho Q??PGT~B??OC~?ipO?T?~U?p~cUo0x>>sleep.comsleep.com>sleep.exedel sleep.comecho wait 2 seconds:sleep.exe 2000如果灶袜用批处理命令的话可以弯辩模在route delete 10.10.0.0后加一句ping -n 60 127.1>nul命埋缓令,60就是延迟60秒,可以任意修改!用快捷方式的方式就不知道了!希望对你有帮助!欢迎分享,转载请注明来源:内存溢出
评论列表(0条)