Batch files under Windows do not have the same Sleep function as Linux for delay processing. Here are two more practical methods to achieve delay:
1. Use the sleep function of WScirpt, with an accuracy of 0.001 seconds
Create a vbs delay file, then call it in a batch file, and use the sleep function of WScript to achieve the effect of sleep.
Actual combat:
1) Create the file sleep.vbs:
echo WScript.sleep 5000 > sleep.vbs
The content of sleep.vbs is as follows:
WScript.sleep 5000。
2) Call it in the batch file and create a sample file test.bat with the following contents:
code show as below:
sc stop OracleOraDb10g_home1TNSListener
Wscript sleep.vbs
sc start OracleOraDb10g_home1TNSListener
2. Use the timing function of ping, with an accuracy of 1 second
Actual combat: Create a sample file test2.bat with the following contents:
code show as below:
sc stop OracleOraDb10g_home1TNSListener
ping -n 3 127.0.0.1>null
sc start OracleOraDb10g_home1TNSListener
Note: 3 is the number of ping packets sent, which can be used as the number of seconds to delay. Set the number of seconds to delay.
>nul avoids screen output, and inputs the output to an empty device, because the result is not needed, only its timing function is used.
3, there are two ways to achieve the Sleep function
One is to continuously read the system time, compare it, and exit the sleep function when it reaches a certain value, but this operation should consume a lot of CPU and is not recommended.
The other is the practice of a buddy in Germany, which directly uses the debug method to generate a timer program. This method may destroy the stability of the system, or it is easy to implant viruses (using other people's code), and it is not recommended.
code show as below:
echo q | debug>nul
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>sleep.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU WwX0GwUY Wv;ovBX2Gv0ExGIuht6>>sleep.com
echo T}{z~~@GwkBG@OEKcUt`~}@MqqBsy?seHB~_Phxr?@zAB`LrPEyoDt@Cj?>>sleep.com
echo pky_jN@QEKpEt@ij?jySjN@REKpEt@jj?jyGjN@SEKkjtlGuNw?p@pjirz>>sleep.com
echo LFvAURQ?OYLTQ@@?~QCoOL~RDU@?aU?@{QOq?@}IKuNWpe~FpeQFwH?Vkk>>sleep.com
echo _GSqoCvH{OjeOSeIQRmA@KnEFB?p??mcjNne~B?M??QhetLBgBPHexh@e=>>sleep.com
echo EsOgwTLbLK?sFU`?LDOD@@K@xO?SUudA?_FKJ@N?KD@?UA??O}HCQOQ??R>>sleep.com
echo _OQOL? CLA? CEU? _FU? UAQ? UBD? LOC? ORO? UOL? UOD? OOI? UgL? LOR @ YUO? >> sleep.com
echo dsmSQswDOR[BQAQ?LUA?_L_oUNUScLOOuLOODUO?UOE@OwH?UOQ?DJTSDM>>sleep.com
echo QTqrK@kcmSULkPcLOOuLOOFUO?hwDTqOsTdbnTQrrDsdFTlnBTm`lThKcT>>sleep.com
echo @dmTkRQSoddTT~?K?OCOQp?o??Gds?wOw?PGAtaCHQvNntQv_w?A?it\EH>>sleep.com
echo {zpQpKGk?Jbs?FqokOH{T?jPvP@IQBDFAN?OHROL?Kj??pd~aN?OHROd?G>>sleep.com
echo Q??PGT~B??OC~?ipO?T?~U?p~cUo0x>>sleep.com
sleep.com>sleep.exe
from sleep.com
The above code should use batch mode. Use sleep.exe 10000 The time unit is milliseconds
4. Download the sleep.exe file from Helper's Home
http://www.bkjia.com/softs/2466.html