The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,161 other followers

Different ways of sleeping/waiting in batch files

Posted by jpluimers on 2013/12/13

About a year and a half ago, I wrote about a Batch file to “Keep Alive” a CMAK generated VPN connection in Windows 7.

It uses ping to wait a certain amount of time, but it has the drawbacks of

  • requiring TCP/IP to be installed (which some headless systems don’t).
  • using N+1 as the number of seconds

Since then, I learned that since Windows Vista and up has timeout command that just waits:

timeout /t 600 /nobreak

Two parameters are used:

  • /nobreak
    does not stop waiting when you press a key
  • /t #
    waits # seconds

(the example is 10 minutes, I use it to regularly run FlushFileCache.exe or FlushMem.exe to empty the Windows file chache and release memory – often more than a gigabyte – back to Windows)

There is also sleep.exe, but that requires the Windows Resource Kit or Windows Server 2000/2003.

–jeroen

via:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: