A cmd.exe sleep command?

SleepIt’s always a surprise when a batch file scripter realizes cmd.exe lacks a sleep command.  But fear not!  The choice command can be used as a substitute.  It lists a set of choices and waits a specified amount of time for the user to choose one.  Choice can be used to sleep for 0 to 9999 seconds (or over 2.7 hours).

Just create the following file and save it as sleep.cmd:

@echo off
set /a SleepTime = %1
CHOICE /N /D y /T %SleepTime% /M "Sleeping for %SleepTime% seconds . . ."


Place it in your aliases bin and you’re all set to sleep from the command line!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: