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:
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.
Posted in Batch-Files, Development, Power User, Scripting, Software Development, Windows | Tagged: batch file | Leave a Comment »
Posted by jpluimers on 2013/08/17
Two years ago, I posted a batch file that gets the parent directory of the batch file that runs.
It was convoluted, using substrings and intermediate environment variables so you needed setlocal.
This one does not any more: for both the directory of the batch file, and the parent directory of that directory, one-liners suffice:
via: batch files: getting directory and parent directory « The Wiert Corner – irregular stream of stuff.
Posted in Batch-Files, Development, Scripting, Software Development | Tagged: batch file, environment variables, software, technology | 1 Comment »