How Sleep command work on Batch file in Windows
>> Tuesday, June 12, 2012
How Sleep command work on Batch file in Windows
When writing a batch file to automate something on a Windows box, I've needed to pause its execution for several seconds and for that i have decided to keep those file on Sleep mode, how it will work under Sleep Mode please let me know.
#2
08-07-2009
Wilbur
Member
Join Date: Oct 2008
Posts: 127
Re: How Sleep command work on Batch file in Windows
Most operating systems provide a command in batch files to sleep, or wait, a certain number of seconds. This is great in that batch files can display text, allowing you time to read before continuing. If you have Python installed, or don't mind installing it (it has other uses too) , just create the following sleep.py script and add it somewhere in your PATH:
import time, sys
time.sleep(float(sys.argv[1]))
In XP, you can edit it in:
My Computer → Properties (menu) → Advanced (tab) → Environment Variables (button) → System variables (frame)
#3
08-07-2009
Billie
Member
Join Date: Feb 2006
Posts: 162
Re: How Sleep command work on Batch file in Windows
Sleep.bat is a Windows batch program that pauses your batch file for temporary before continuing. Sleep.exe is included in most DOS resource kits. If that is the case, that's the best idea. If you don't have it, it's easily found on the Internet (I added it to my Windows XP). I assume of course that you can add executable to your box. The easiest solution in Windows XP / 2003 environment is to install Windows Server 2003 Resource Kit Tools. This tool kit will install the Sleep.exe program into your machine, which you can use as
SLEEP n
to sleep for N sec. If you want to sleep for just a few milliseconds u can use this command as
SLEEP –M n
#4
08-07-2009
Jannat
Member
Join Date: Jan 2009
Posts: 163
Re: How Sleep command work on Batch file in Windows
The Resource Kit has always included this. At least since Windows 2000. Sleep.bat uses the "ping.exe" program to emulate the sleep function. The "ping.exe" program is distributed with most versions of Windows operating system.
Sleep.bat takes advantage of the SetNumberOfArguments.bat (GPL) script that is available on this web site. So to use Sleep.bat, you'll have to download SetNumberOfArguments.bat, if you don't already have it.
0 comments:
Post a Comment