Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Batch File Delay


  • Please log in to reply

#1
magusbuckley

magusbuckley

    Member

  • Member
  • PipPipPip
  • 626 posts
Hello:

I'm looking for a command that will delay processing of a batch file for a defined period of time. I'm running XP Home and can't find a working command anywhere. The only command I've found that works so far is the PING command, but I don't want the user to see that I'm pinging another machine to create the delay. In addition, the PING command can only be set for a certain amount of network responses, not a defined number of time.

Any and all information will be greatly appreciated.

Thanks
  • 0

Advertisements


#2
Swandog46

Swandog46

    Malware Expert

  • Member
  • PipPipPipPip
  • 1,026 posts
  • MVP
See:
http://www.robvander...e.com/wait.html

The most popular way to do it is by ping, like you said. In particular, I use this in aproposfix for example:

ping 1.1.1.1 -n NumberOfRetries -w TimeToWaitBetweenTries

so that it waits for approximately (NumberOfRetries) multiplied by (TimeToWaitBetweenTries) milliseconds.

If you want to suppress the output to the screen, just redirect it to a file with >> , and then delete the file (it's a hack I know but it would work). For example:

ping 1.1.1.1 -n 3 -w 1000 >> errortext.txt
del errortext.txt

:tazz:
  • 0

#3
magusbuckley

magusbuckley

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 626 posts
Hello:

I tried your method to hide the ping responses and it worked beautifully. Thank you for the information.

Magus
  • 0

#4
Swandog46

Swandog46

    Malware Expert

  • Member
  • PipPipPipPip
  • 1,026 posts
  • MVP
Glad to hear it! :tazz:
  • 0

#5
NishanW

NishanW

    New Member

  • Member
  • Pip
  • 1 posts
More refined command for Swandog46's sugession

ping 1.1.1.1 -n 3 -w 1000 > null

with this u dont have to delete a file

Regds
  • 0

#6
Swandog46

Swandog46

    Malware Expert

  • Member
  • PipPipPipPip
  • 1,026 posts
  • MVP
Indeed, that is a better idea --- thanks! :tazz: Can't believe it didn't come to mind sooner.

Most people when using that syntax will write >NUL instead of > null , just for reference. :)
  • 0

#7
Krizniak

Krizniak

    Member

  • Member
  • PipPip
  • 33 posts
:tazz:
Why not creating a command line utility in any language, which can get the number of seconds to wait on the command line and call the win32 sleep api to make the program waiting ??

So, you just have to copy this utility in the path or current directory, and let's go !
  • 0

#8
thillryan

thillryan

    New Member

  • Member
  • Pip
  • 2 posts
Just What I Was Looking For Thanks!!!
  • 0

#9
Ebsuru

Ebsuru

    Member

  • Member
  • PipPip
  • 39 posts
I just wanted to give you some extra resources to help you out in the future with batch file scripting. :blush:

Try this channel:

http://www.youtube.com/codestop

It has the most complete series on batch file scripting on YouTube, it should help you.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP