Gnubie
Gnubie

Reputation: 2607

How to pause Windows TIMEOUT command?

I use

TIMEOUT /T 10

in a batch file to keep its window open so that I can read some output. Most of the time, I'm happy for it to close in 10 seconds. Sometimes I want to close it immediately and press a key. Very occasionally I want more time to read it. Is there a key I can press to pause the countdown until I press the same or another key? Either the countdown continuing or the window closing is fine.

PAUSE

or

TIMEOUT /T -1

are not acceptable as they don't have the auto-closing behavior.

Upvotes: 0

Views: 553

Answers (1)

mnistic
mnistic

Reputation: 11020

The PING command can be used to simulate TIMEOUT. To sleep for 10 seconds:

PING -n 11 127.0.0.1 > NUL

To pause sleeping, you would hit Break. Then, to unpause and continue sleeping you would hit Ctrl+Break.

Upvotes: 1

Related Questions