time delayed command

February 21, 2010 at 18:05:45
Specs: Windows 7
I am writing a batch file that copies an EXE file
to a directory on the %homedrive% and want
to write it so that it will copy the file then wait
5 seconds, if i don't press y or yes with in that
5 seconds it completes the batch file and
closes if i do press y or yes i want it to start
the application then close the batch file.

any help is much appreciated!!!

See More: time delayed command

Report •

February 21, 2010 at 21:10:20
download (or find on your system) choice.exe, it has a timing feature.

Report •

February 21, 2010 at 21:20:42
i had used the choice command before and forgot it had a timing
option, Thank you

Report •

February 22, 2010 at 04:35:42
Maybe interesting to know, but there is a little bug in CHOICE (still) :

If you press ANY key that is NOT in the list of keys he is waiting for, the time-out feature stops, and the CHOICE command reverts to a simple key-press feature (a key from his list).

Example, do the below command, and press any alfabet-key apart from Y or N, within 5 seconds:

choice /N /C:YN /T:N,5 Press Y or N :

Note you will see the command wait ... forever. What you can do to prevent this, is to include other characters :

choice /N /C:ABCDEFGHYN /T:N,5 Press Y or N :

But, then you need to cover the errorlevels correctly. Also note that whilst covering a lot of keys, some may not be covered against this bug ... but they are less likely to occur.

Report •
Related Solutions

Ask Question