I'm trying what I thought would be "hello world" to learn the analog of fork/exec on Windows: create a subprocess that sleeps for one second and then exits. GNU coreutils have a nice sleep tool in /bin
. There seems to be no analog on Windows. What is a simple tool I can invoke as a subprocess on Windows?
You can wait via timeout.exe /t 1 /nobreak
. It displays a countdown in the console. If this is a problem, you can use the creation flag CREATE_NO_WINDOW
to force it to allocate a new console that has no window. The /nobreak
option can be omitted in this case, since there's no window for a user to press enter to bypass the countdown.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.