sleep or wait in batch files: pause cmd

Diese Seite gibt es auch in Deutsch

The function wait or sleep was not available in BATch files by default.
Remedy is a small detour via the ping Command

sleep or wait with ping

Command:

@ping -n 10 localhost> nul

ย waits in about 10 seconds (-n 10) and then continues to execute the batch file.

retrofit sleep command

sleep.cmd in C:\Windows\System32

@echo off
@ping localhost -n 2 > NUL
@ping localhost -n %1 > NUL

Windows Vista/7/8/10/11

since Windows Vista there is the command:

timeout

timeout /T 10 waits 10 seconds, the waiting time can be skipped with any key, to prevent this there is the parameter: /nobreak
timeout /T 10 /nobreak

further topics

positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!


Questions / Comments