You have less worries
Yes, the sky is blue

Simple XP tip: Alarm clock

1 October 2007, by Ben    36 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).

36 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
Colombiche 4 Aug 2010, 02:44 link

What about if you want the alarm to go off a month from today?

Cronk 21 Oct 2010, 02:58 link

Chang the link from a wav file to a streaming audio link and you have a radio alarm clock, cool…

Fai 10 Feb 2011, 19:17 link

Thanks for advise man. I have made the batch file, it works correctly. I can RUN the alarm it works perfectly. Somehow the timer is not working. I typed “at 15:13 alarm” in cmd prompt it said “Added a new job with job ID =9″

And then when the time come, nothing happens.

Any advise?

Fai 10 Feb 2011, 20:47 link

All right, so I went to scheduled task, I found the problem. It’s because I got to insert the ID password or else it couldn’t execute any task.

So now, dear. Tell me if there is an easy way to include the ID password in the command in cmd prompt? So that I wouldn’t have to go to sheduled task everytime I need an Alarm ***

Fai 10 Feb 2011, 21:13 link

XP is gay! There is no way to execute this action. I will have to remove the password of my ID just to execute it in the cmd prompt. LoL It’s ok. Dude, great tutorials.

Fai 12 Feb 2011, 23:51 link

quattrocchi: I hope this reply isn’t too late. Anyway. You could remove “/play /close /new” and it should work. I tried it. It works perfectly without those commands , an example since I use KMPlayer and put my music file on shared folder.

C:\Program Files\The KMPlayer\KMPlayer.exe” C:\Docume~1\AllUSE~1\Docume~1\MyMusi~1\DisneyCircle~\1.mp3

In one line, notepad, saved as BAT file

GMontag 9 May 2011, 04:03 link

These instructions didn’t quite work for me. I initially put the batch file in the C:Windows directory, but nothing happened. Also, when I open the cmd window the prompt reads:

C:Documents and SettingsOffice>

So I put the batch file in the D&SOffice directory. Also, I had to specify that the file was a batch file:

at 11:55 alarm.bat

This fixed the issue for me! (In addition, make sure you have MediaPlayer installed (I didn’t) and that you have the notify.wav file in the Media folder or use a different, louder file.) Great suggestions above with the streaming audio!

davea0511 11 May 2011, 01:30 link

On my win7 machine the wmp player name is different (wmplayer.exe, not mplayer2.exe)… I had to use this: “c:Program FilesWindows Media Playerwmplayer.exe” /play /close /new c:windowsMedianotify.wav

I use this with utorrent to tell me when a torrent is finished (it lets you specify a command-line to execute when a torrent is done downloading).

As for doing this as a reminder, can’t you do this with XP’s task scheduler (don’t know, myself since I’m on Win7). Regardless, I recommend the freebie version of system scheduler (from splinterware.com) for alarms – their popups windows stay on-top and are super reliable and configurable. No scripting necessary. I’ve tried all the freebie notifier apps and theirs is the best. No, I’m not associated with them

June Todd 22 Jul 2011, 12:47 link

Thanks much. I have created a batch program that works. But I need to sound to be louder. I keep earphones plugged in and I need to be able to hear the file even if the earphones are hanging on the bulletin board next to me. Does mplayer2.exe have a volume parameter?

June Todd 23 Jul 2011, 01:33 link

Re my previous post about mplayer2: I have been searching for documentation or a user manual, and I have come up dry. Is there such a thing?

June Todd 23 Jul 2011, 01:35 link

Again: or is the source code available? I could figure it out from that.

Ben 23 Jul 2011, 03:51 link

Hi June, it doesn’t look like mplayer2 has a volume parameter (http://support.microsoft.com/kb/241422). However, there’s a cool little command line utility called NirCmd that allows you to do it: http://www.nirsoft.net/utils/nircmd.html

Download it and try “nircmd.exe setsysvolume 65535″ to set the volume to maximum, for example.

June Todd 24 Jul 2011, 07:00 link

It works! Thank you so much. I am a happy camper.

Ollie 18 Mar 2012, 06:22 link

I appear to be having a problem making this work i’m typing at 6:15pm c:testbatchfilesalarm.bat is says it added and what ID, when i type at 1 it shows the following

Task ID: 1 Status: OK Schedule: Tomorrow Time of day: 18:15 Interactive: yes Command: C:tesbatchfilesalarm.bat

so it’s scheduled but nothing happens, if i just type C:tesbatchfilesalarm.bat the file executes fine. Any advice?

Ollie 18 Mar 2012, 06:28 link

just to add that the missing in my last sentance is a typo on here not when i type the command line so it should be C:testbatchfilesalarm.bat

Ollie 18 Mar 2012, 06:29 link

“C:testbatchfilesalarm.bat”

Ollie 18 Mar 2012, 06:29 link

ok so it won’t type by slashes lol

Lazos 29 Jun 2012, 00:12 link

I tried your script and I have an issue on my XP pro It run if I’m cd [to-batch-file] but otherwise it doesn’t recognize the alarm order, even that I put it in my Path and when I’m on the alarm.bat directory (with cmd.exe) it doesn’t respond when I’m scheduling a time. I’m also sorry to bug you bat as mentioned before is too cool to let go!! :-)

Ali 29 Aug 2013, 11:12 link

lol…all you have to do is go to schedule task in the control panel and set it to play some kind of audio, you could download all sorts of alarm sounds on the web.

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.