How to make a timer with a signal from the command line in Windows


Timer.

  • timeout /t 10 /nobreak > NUL

/t specifies the time to wait in seconds


/nobreak won't interrupt the timeout if you press a button (except CTRL-C)

> NUL will suppress the output of the command

  • sleep

Usage: sleep time-to-sleep-in-seconds

sleep [-m] time-to-sleep-in-milliseconds

sleep [-c] commited-memory ratio (1%-100%)

You can just say sleep 1 for example to sleep for 1 second in your batch script

  • To wait 10 seconds:

choice /T 10 /C X /D X /N

How to generate the singal?

You can write a DOS batch file that beeps by doing the following- at the DOS prompt type:

echo @echo (Alt-7)>beep.bat

but instead of typing the characters: "(Alt-7)", you hold down the Alt key and press 7 on the numeric keypad.

Don't use the 7 on the qwerty part of the keyboard, it has to be on the keypad, and Num Lock has to be on.

The effect of this is to output the characters:"@echo " followed by a non-ASCII character with a decimal value of 7, into a new file called beep.bat

Check ASCII character with code 007 under:

ASCII character codes and html, octal, hex and decimal chart conversion

In the end you can use your own script signalFromCommandLine.bat and inside:

@echo off

sleep 3

echo ALT+7 character

echo “singal!”

Put this script under your PATH system variable so you will be able to use it.