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: