PAUSE with a timeout?

May 30, 2008
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?
 

rps

Jul 6, 2008
440
6
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_$
 
May 30, 2008
238
2
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.
 

rps

Jul 6, 2008
440
6
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.
 
May 30, 2008
238
2
You could always use Inkey /w and just not use the returned value.

Hm, that's pretty much better than the keystack solution in every conceivable way.

Thanks again! :)