You have less worries
Yes, the sky is blue

Simple XP tip: Alarm clock

1 October 2007, by Ben    17 comments

Alarm clockI’ve come to quite like XP. But there’s the odd missing feature, like the fact that Windows has no alarm clock. I don’t mean a super-fancy Outlook Calender application, where you have wade through scads of GUI just to get a reminder sound — I mean a simple beep-beep alarm clock.

Then I discovered that XP (especially XP Pro) has a reasonably rich set of command line utilities. Well, not rich if you’re used to Unix-like shutils or txtutils, but rich if you’re from a Windows 95, “the most powerful command is dir /w” type of background.

So of course I wanted my alarm clock. No doubt old news for Unix-heads, but enter the Microsoft version of the at command. (Or the more powerful schtasks, but I think that’s only in XP Pro.)

To get my alarm clock, I first made a batch file which just plays a sound, and stuck it in my path, say, c:\windows. Here’s my alarm.bat that plays an alarm sound using Media Player (put it all on one line):

"c:\Program Files\Windows Media Player\mplayer2.exe"
/play /close /new c:\windows\Media\notify.wav

And then when you want to set an alarm, just go to the command line (Start > Run > “cmd”) and type something like:

at 7:30pm alarm

Or, if you want an alarm at 6am every Mon, Wed, and Thu:

at 6am /every:m,w,th alarm

Trivial, I know. But what I like is that you don’t have to download yet another 1.5MB program to do it (like this one or this one).

17 comments (oldest first)

cire333 20 Feb 2008, 19:15 link

nice tip, i threw my last alarm clock out the window on accident.

Mark Thakkar 6 Sep 2008, 02:35 link

Thanks very much for the tip. BTW, I found I had to make the .bat extension explicit and use a 24-hour clock:

at 19:30 alarm.bat

DarthVader 29 Jan 2010, 10:24 link

Hmmm, doesn’t work for me for some reason… How does typing “alarm” in work? That isn’t really a command, but I’ll experiment.

Ben 29 Jan 2010, 10:29 link

DarthVader, “alarm” isn’t a built-in command, but if you save out a file alarm.bat somewhere in your PATH, as described above, it should work.

DarthVader 29 Jan 2010, 10:50 link

Kay, will try it.

DarthVader 29 Jan 2010, 10:57 link

I did what you said, but… When I type AT /YES it says

ERROR 1 TOMMOROW 5:53 PM ALARM

And nothing happens. I’m sorry to bug you, but this looks so cool!

Ben 29 Jan 2010, 11:03 link

I’m not sure, but there’s probably some issue with your alarm.bat or it’s not in your path. Assuming you’ve already created the alarm.bat file, check what happens when you just type “alarm”.

DarthVader 29 Jan 2010, 11:35 link

Hmm, I saved it to my desktop. The status reads OK until the time is what I set it to, and then it goes to ERROR. I hope I’m not a bother to you, but I am totally confused…

DarthVader 29 Jan 2010, 11:38 link

OH! I understand, you gotta make alarm.bat a custom command, as they call it. OK! Thanks, I’ll try it.

DarthVader 29 Jan 2010, 12:27 link

Hmm, is there any way to make ia alarm on the current day? Like, if you’re testing it out? This will probably be my last comment, I just need to know what you do step ny step, and that would be good, thanks (if that’s too muxh that’s ok just don’t respond).

Ben 29 Jan 2010, 12:46 link

I think if you give any time in the future, it should work fine. So if it’s 1:45pm here now, and you say “at 2:00pm alarm”, it should alarm in 15 minutes. For further details, you’ll probably have to check out the Windows XP “at command” documentation.

DarthVader 29 Jan 2010, 12:59 link

sight Oh well, thanks for your help. You were right, but no matter what I do, the status always ends up as ERROR.

DarthVader 29 Jan 2010, 13:02 link

I GOT IT!! Thank you so much for your tolerance and helpfulness!

Carolyn 24 Feb 2010, 04:36 link

I like this idea for a very simple alarm run out of command prompts – but I would want a (static) pop-up on my screen instead of an audio sound. I’m unfamiliar with batch files, so I’m not sure where to start. Thoughts?

Nonaz 16 Apr 2010, 12:19 link

I love the way you wrote this. I am totally the “Windows 95, the most powerful command is dir /w” type… :)

Gonna try it just for that.. Thank you!! :D

Regards, Nonaz

quattrocchi 21 Apr 2010, 09:37 link

Hi,

xphome sp3 — my alarm.bat written as you say to, is in the same place you put yours, and wmplayer2.exe in the same place, so the parameters are the same. ‘alarm’ produces no sound but this error:

Microsoft Windows XP [Version 5.1.2600]

`C:\Documents and Settings\bri>/play /close /new c:\windows\Media\notify.wav`

‘/play’ is not recognized as an internal or external command, operable program or batch file.

Ben 21 Apr 2010, 10:31 link

Hi quattrocchi, I’m not sure exactly, but yours looks like it’s trying to execute a program “/play” (because it says “/play is not recognised) when it should be executing wmplayer2.exe, like so:

"c:\Program Files\Windows Media Player\mplayer2.exe" /play /close /new c:\windows\Media\notify.wav

Add a comment

We reserve the right to edit or remove your comment if it’s spammy, offensive, unintelligible, or if you don’t give a valid email address. :-)

We’ll never share your email address.