Go Back   TechArena Community > Technology > Technology & Internet
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 08-07-2009
Member
 
Join Date: Apr 2008
Posts: 242
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.
Reply With Quote
  #2  
Old 08-07-2009
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)
Reply With Quote
  #3  
Old 08-07-2009
Member
 
Join Date: Feb 2006
Posts: 331
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
Reply With Quote
  #4  
Old 08-07-2009
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.
Reply With Quote
Reply

  TechArena Community > Technology > Technology & Internet
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How Sleep command work on Batch file in Windows"
Thread Thread Starter Forum Replies Last Post
FTP Upload batch file doesn't work properly in Task Scheduler supphavith09 Windows Server Help 1 09-02-2012 07:39 AM
How to work with if command and batch file kolton Operating Systems 5 01-12-2010 12:09 AM
stringtokenizer in batch file / dos command sayeed Software Development 2 14-10-2009 01:26 PM
Can We check the exit command in the batch file Dhruv Software Development 3 30-12-2008 11:56 PM
Fast User Switching via Command Line or Batch File? Woody45 Vista Help 1 18-03-2007 12:22 AM


All times are GMT +5.5. The time now is 06:59 AM.