Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know this could probably be done somewhat easily in something like AutoHotkey, but is there an app you could do this with?

Say something like

runwait C:\Windows\notepad.exe 12000

So, a command line app would be best, because I want to run it from Launchy.

Maybe one of NirSoft's apps does this...

share|improve this question
You should clarify exactly what you want. For example, you didn't mention that it has to be usable from the command line. – Sasha Chedygov Sep 28 '09 at 0:02
Well, I think the runwait example shows parameters, but I guess that doesn't always mean its CLI, so I guess you're right. Edit coming up. – Nathaniel Sep 28 '09 at 1:25
@Nathaniel, just curious, how are you using this? – hyperslug Sep 28 '09 at 1:42
@hyperslug I don't know exactly what I'd use it for, but the other day I was wishing I could do something like that from Launchy so I could run something (not using this command) and tell the computer to standby in a couple of minutes. – Nathaniel Sep 28 '09 at 23:55
up vote 1 down vote accepted

You can use the built in at command and specify a time:

at 7:30 /interactive notepad.exe

more geared to StackOverflow, but I just wrote a quick Python script that will utilize the at command and make the time conversions for you, it can be compiled to an executable with py2exe:

import sys,os,time

if len(sys.argv) != 3:
    print "Invalid number of arguments supplied"
    print "Usage: <path_to_file> <time_in_seconds>\n"
    print "Example: C:\Runme.exe 12000"

wait = time.time()+float(sys.argv[2])
futuretime = time.localtime(wait)
formatted = time.strftime("%H:%M",futuretime)
execstr = "at",formatted,"/interactive",sys.argv[1]
os.system(' '.join(execstr))

example of use as shown in the script: C:\Runme.exe 12000

that will run the specified file in 12000 seconds (200 minutes/3 hours and 20 mins)

What the script does is basically grabs the current time, converts it to epoch time, adds the amount of seconds you specified back to that, converts the time back to something the at utility will accept, and adds it as a job.

share|improve this answer
i don't think Nathaniel wants to start a program at a certain time but rather after x amount of hours/minutes/seconds. – Molly7244 Sep 27 '09 at 23:31
I don't think he wants a GUI either :\ – John T Sep 27 '09 at 23:31
hmm, must have slipped my attention :) – Molly7244 Sep 27 '09 at 23:33
Oh, nice. Thanks for going to the trouble of whipping up some Python for me. – Nathaniel Sep 28 '09 at 1:24
I'm rusty anyway haven't programmed in a while, needed practice. Best part of this method is that you can run the command then close the cmd window. – John T Sep 28 '09 at 1:37

Windows has no builtin wait command. However, you can fake it with ping:

ping -w 1000 -n 5 >NUL:

This pings five times with each ping having a timeout of one second. Obviously, you need to pick an IP address that you know doesn't exist. The ">NUL:" throws away its output. You can then chain it with an "&":

ping -w 1000 -n 5 >NUL: & calc

I suppose if you wanted to, you could create a .bat file that could take a parameter to fake the sleep command. If you're going to do that, though, there are any number of sleep.exes you can download. Cygwin comes to mind.

Here's a batch file that matches your syntax above:

@echo off
ping -w 1000 -n %2 >NUL:
call %1

Just save it to runwait.bat

share|improve this answer
Interesting approach with the fake pings. Nice thinking. A sleep program would definitely be cleaner, though. I look into it. Thanks. – Nathaniel Sep 28 '09 at 1:23
the -w switch is in milliseconds not seconds. You're looking for 1000. With this solution you'd also need to keep the command line open for the entire duration of the command. – John T Sep 28 '09 at 1:27
+1 nice thinking! :) – Molly7244 Sep 28 '09 at 1:30
@John T: -w is seconds on my XP systems. – wfaulk Sep 28 '09 at 2:02
Check the output of ping /? - "-w timeout Timeout in milliseconds to wait for each reply." – John T Sep 28 '09 at 2:15

There is a sleep utility for batch files free for download:

It has been suggested that you take advantage of ping to get the result that you want. Why not combine that suggestion, and the sleep command/utility from the site above?

share|improve this answer
Anyone have a individual download link for sleep.exe? – Nathaniel Sep 29 '09 at 0:11
Seems to have gone, maybe you should try the Windows PowerShell (free from Microsoft).… – tgbarnett Sep 29 '09 at 8:10

Windows Time Bomb is an easy-to-use application that will enable you to schedule it to launch any program you want. Set your time to open a file or launch an application and start timer and WTB will launch it for you.

alt text

Windows Time Bomb is freeware.

not exactly a beauty, but not as ugly as WTB:

The main feature of TimeLeft is a powerful customizable reminder, which can show a message, play music (any formats including mp3) or open a link, document, execute an application, turn off your monitor or shutdown your PC.

TimeLeft is freeware.

and here's one with command line funtionality:

Countdown Clock for Windows

This useful utility allows you to count down time with an alarm. It's great when needing a countdown timer to be reminded of a specific event such as checking the roast cooking in the oven, checking the water level when filling your hot tub, or what ever else you can concoct. Supports up to 720 hours in the countdown.

With Countdown Clock you can:

Play any multi-media file including movies, music or sound files when the counter gets to 00:00

Launch any program of your liking when the alarm goes off including programs that will shut down your system.

The clock can be hidden in the system tray.

The clock can be resized to virtually any size on your desktop including FULL SCREEN.

Instructions for passing command line arguments:

countdown HH MM SS Y "Media file" "File To Run"

Countdown Clock is shareware, try before you buy.

share|improve this answer
Wow, that is hideous. I'm almost impressed by the ugliness. – jtbandes Sep 27 '09 at 23:31
might hurt your eyes :) – Molly7244 Sep 27 '09 at 23:35
Should be submitted for Download Squad's Fugly Friday. :D – Nathaniel Sep 27 '09 at 23:40
So does it have a command line function? I'm looking to do this thing from Launchy. Also, the site is ugly, too! – Nathaniel Sep 27 '09 at 23:42
NOW he's asking for command line functionality ... update your post! :) – Molly7244 Sep 27 '09 at 23:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .