Windows – Is it a bug or intentional behaviour that the “timeout” command aborts when you maximize the window

batch filecmd.exetimeoutwindowswindows 10

Steps to reproduce:

  1. Create a test.bat file with timeout /T 60 as its only contents.
  2. Run it.
  3. Maximize its (cmd.exe) window.

It now immediately aborts and closes itself. At least for me.

And yes, I know about the /NOBREAK flag, which I now use and which does prevent not only keypresses but also the maximization bug (?), but I still wish to know why this happens.

I'm not sure why I care specifically about this since I keep finding show-stopping, serious bugs constantly while trying to use Windows, but somehow this seems like a "core utility" and it really bothers me that it just kills the window when you maximize it. It's not mentioned in the timeout /? output, which purely speaks of keypresses.

Note: This does NOT happen if you open a cmd.exe and just type the command into it. It has to be in a .bat file for this to occur.

Best Answer

  • Maybe use powershell for safe delay:

    powershell -noprofile -command "& {[system.threading.thread]::sleep(60000)}"
    

    Use this command in batch file.