?
Solved

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

Posted on 2009-03-30
3
Medium Priority
?
499 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 71

Accepted Solution

by:
Qlemo earned 1500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

719 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