Solved

bat script for Win XP, How can I sleep the process

Posted on 2009-03-30
3
496 Views
Last Modified: 2012-05-06
Hi,

See my bat file for XP

@ECHO OFF
:start
test.exe
sleep 300
goto start

I want to set delay of 5 min (300s), but it is throwing the error
"'sleep' is not recognized as an internal or external command"
In Linux I can use sleep, what is the equivalent in Win XP and Win 2003 server.
Basicaly I want to execute the test.exe in every 5 min.
0
Comment
Question by:spectrumsofttech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 28

Expert Comment

by:TextReport
ID: 24016696
0
 
LVL 19

Expert Comment

by:PeteJThomas
ID: 24017070
Can you not just remove the sleep line and then schedule the bat file to run every 5 mins? Or is that not an option?
0
 
LVL 70

Accepted Solution

by:
Qlemo earned 500 total points
ID: 24019630
The traditional approach for a sleep is, as found in many posts here, to use a ping on localhost. It does not consume CPU, and needs no other resources:

@ECHO OFF
:start
test.exe
ping -n 301 127.0.0.1 >nul
goto start

You need to use 301 as ping starts a ping, waits a second, than pings again ... To build a fence with n segments, you need n+1 poles ;-).

A variant would be to use the timeout of ping with a non-existent target:

ping -n 1 -w 300 1.1

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question