Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

PAUSE with a timeout?

May
238
2
What is the best way to achieve the effect of the PAUSE command but with a timeout?

That is, after some specified time, PAUSE behaves as if someone had simply pressed a button.

The best I came up with myself was this:

Code:
keystack /W50 End
pause Press a key to continue or Ctrl-C to cancel.....

I used End key as that should have no bad side-effects if the user presses a key himself and the key is added to the TCC command line instead of stopping the PAUSE.

Might there be some built-in commands to get this same effect?
 
What is the best way to achieve the effect of the PAUSE command but with a timeout?

That is, after some specified time, PAUSE behaves as if someone had simply pressed a button.

The best I came up with myself was this:

Code:
keystack /W50 End
pause Press a key to continue or Ctrl-C to cancel.....

I used End key as that should have no bad side-effects if the user presses a key himself and the key is added to the TCC command line instead of stopping the PAUSE.

Might there be some built-in commands to get this same effect?
In V22 there is a wait switch available as well as text:
Code:
v22.00.29_$pause /?
Suspend batch file or alias execution.
PAUSE [/Wn][text]
        /W(ait n seconds)

v22.00.29_$pause /w2
Press any key when ready...
  -> wait 2 seconds
v22.00.29_$
 
Good to know, thank you. I guess there's no point looking for it elsewhere then if it has now been added to the PAUSE command itself.

I just recently upgraded from v15 to v20, so will probably be a while before the next upgrade.
 
Good to know, thank you. I guess there's no point looking for it elsewhere then if it has now been added to the PAUSE command itself.

I just recently upgraded from v15 to v20, so will probably be a while before the next upgrade.
You could always use Inkey /w and just not use the returned value.
Code:
v22.00.29_$inkey /w3 ^n^t Hello! Pausing for 3 seconds ^n %%Vname

         Hello! Pausing for 3 seconds

v22.00.29_$
Not as clean as the new PAUSE but workable until you can upgrade.
 
Back
Top