Tech Tips

A Simple Timer/Reminder

If you work in IT, you'll probably find this scenario very familiar: you have a task to complete, but you're not sure how long it will take - and you have other things to do in the meantime, but you still want immediate notification when the background task finishes.

My old solution was to simply keep a cheap cooking timer next to my computer, until I realized that the same thing can be accomplished using software that's already included with Windows. Read on for the details.

Here's an example command:

ping localhost -n 60 && msg * "An alert message"

Typically you would enter this command into the "Run" dialogue box, or into a command prompt window. This is actually two different commands, separated by a double-ampersand ("&&") - this tells the Windows command shell to run the two commands in sequence. In other words, the first command is run and, when it finishes, then the second command is run.

The first part (ping localhost -n 60) tells your computer to "ping" itself 60 times. And because the computer is ping'ing itself, each ping takes a consistent amount of time (about 1 second); so ping'ing the address "localhost" 60 times will take about 60 seconds.

The second part (msg * "An alert message") pops up a small alert message, containing an "OK" button and the text "An alert message". Normally the "msg" command is used for sending messages to other computers, or other users on the same computer - but on a desktop system with a single user, the message will only go to you.

By linking those two commands together with the double-ampersand, you create a quick-n-dirty countdown timer with a customized reminder/alert message. So when you run that command, the alert message will appear after 60 seconds.

You can make this setup even more convenient (and save yourself some typing) by setting up a simple batch file. To do that, use Notepad (or another text editor) to create a file containing the following:

ping localhost -n %1 && msg * "%2"

Now save the file to your C:\WINDOWS\ folder and give it a name like "timer.bat". Because the file is in your Windows folder, you can run the command "timer" from anywhere on your computer - and not just C:\WINDOWS\. For example, here's the example from earlier, but using the "timer" batch file:

timer 60 "An alert message"

And if you wanted to get fancy, it would be trivially-easy to create variations of that batch file, with pre-set times and/or alerts - E.g. an egg timer. If you can think of any other clever ways to use this trick, send them in! We'll post the most useful ones as tech tips.






Comments

Linux and Windows web hosting plans start at just $7.95/mo.