bat command delay execution

1. Using the sleep function of WScirpt, the precision is 0.001 seconds

Create a vbs delay file, then call it in a batch file, and use the sleep function of WScript to achieve the effect of sleep.

Actual combat:

1) Create the file sleep.vbs:

The content of sleep.vbs is as follows:

WScript.sleep 5000。

2) call vbs

 

start /wait sleep.vbs

1. Use the choice command

choice /t 10 /c yn /n /dn /m (open after 10 seconds)

CHOICE [/C choices] [/N] [/CS] [/T timeout /D choice] [/M text]
Description: This tool allows the user to select an item from a selection list and returns the index of the selected item.
Parameter list: 
/C choices Specifies the list of options to create. The default list is "YN".
/N Hides the option list at the prompt. The preceding message is displayed and the option remains enabled.
/CS Allows selection of case-sensitive options. By default, this tool is case insensitive.
/T timeout Number of seconds to pause before making the default selection. Acceptable values ​​are from 0 to 9999. If 0 is specified, there will be no pause and the default option will be selected.
/D choice Specifies the default choice after nnnn seconds. The characters must be in the set of choices specified with the /C option; at the same time, nnnn must be specified with /T.
/M text Specifies the message to display before prompting. If not specified, the tool only displays hints.

Guess you like

Origin blog.csdn.net/qq769919187/article/details/112038195