Share via

Batch "timeout" command not waiting as supposed to

Anonymous
2023-03-23T04:37:25+00:00

I have the command TIMEOUT /T 8 coded into batch files that have worked for ages. Suddenly it's no longer waiting for the timeout, just immediately exits.

If I run it manually from a cmd.exe window prompt, it works. In a batch file .. 99% of the time it fails. It will display the initial countdown time, but then exit. No waiting at all!

e.g.

TIMEOUT /T 8

*Waiting for 8 seconds, press a key to continue ...*​

to only then move onto the next command (when debugging, that was a "PAUSE" which did work - but not the thing I wanted to happen [a 'forever' timeout time!].

My Windows11 is patched fully up to date.

Windows for home | Windows 11 | Performance and system failures

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

17 answers

Sort by: Most helpful
  1. Anonymous
    2023-09-29T04:26:23+00:00

    As previously suggested, I fixed my problem by starting the batch file with the following code:

    :: the Timeout 0 is needed to fix a MS screw-up

    @Echo Off
    TIMEOUT /T 0 >NULL

    Leave it to microsxxt to botch something up in their 'new and improved' windows 11 that had previously been working in every iteration since Win 3.11 (and probably back to DOS).

    3 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2023-06-21T12:05:35+00:00

    I have the same problem as LordenFamily and same here, using for personal use in batch files. I really don't understand why you are making forums where we can ask questions to then redirect to other forums because you don't have the abilities to respond to the answer. Can't you ask to a more competent person ? We are talking on MS forum...

    3 people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2023-03-23T06:10:01+00:00

    No, this is personal use & absolutely nothing to do with any business related identity. It is end user computing - cmd files written for personal use on home PC.

    This Microsoft command is documented here on Microsoft's own website .. strangely under windows server admin pages despite being a "CMD.EXE" standard command, for me, being run on Windows 11 HOME EDITION!

    https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/timeout

    So, what's gone wrong with windows desktop version upgrades recently?? When will it be fixed?

    3 people found this answer helpful.
    0 comments No comments
  4. Anonymous
    2023-09-29T04:07:41+00:00

    I believe the issue lies with Windows Terminal (wt.exe). If timeout executes within a new Windows Terminal window, it acts as though a key is pressed and immediately terminates.

    If I run cmd.exe in Windows Terminal, running timeout /t 5 or cmd /c timeout /t 5 works as expected, but start "" timeout /t 5 launches a new window which exhibits the issue. Similarly, running timeout /t 5 from a (Win+R) Run dialog exhibits the issue.

    It probably relates to an older "feature" of timeout; "input" from resizing the window can also cause it to terminate. (superuser.com: Is it a bug or intentional behaviour that the "timeout" command aborts when you maximize the window?)

    The TIMEOUT /T 0 workaround previously posted by LordenFamily likely works by removing this non-keyboard input from the buffer.

    If you search "Developer settings" in the Settings app, or find "Privacy & security > For developers", there should be a "Terminal" setting. When this is set to "Let Windows decide" (which is probably the default), it appears to use Windows Terminal for processes launched normally and Windows Console Host for processes which run as administrator. Setting it to "Windows Console Host" bypasses the issue, but then you don't get the benefit of any Windows Terminal features.

    2 people found this answer helpful.
    0 comments No comments
  5. Anonymous
    2023-03-23T09:33:14+00:00

    It's on server pages because those Commands are rarely use in consumer forums where we service 1.5 billion Windows consumers.

    What is the exact problem with Version Upgrades you're having? This is something I deal with almost every day here. It is a common issue most often caused by the underlying condition of the install. The way we know this is that millions have done a gold standard Clean Install and not one I've seen has ever come back with further problems:
    http://answers.microsoft.com/en-us/windows/wiki...

    I'll be glad to help you with that and anything else you need. For the scripting I'd ask in the developer forum to save time since that's all they do there.

    I'm not having "problems" with version upgrades of anything as such. I logged this 'fault' thru the consumer path of MS website support .. maybe it has somehow appeared under business section??

    As I've said, I'm a home user, and my Windows updates apply thru Windows Update service provided to consumers of Windows 11 Home Edition. I assume Microsoft update exe files in WIndows 11 Home edition, and at least for me something has caused the TIMEOUT.EXE (as found in %SystemRoot%\System32\timeout.exe) to fail in a std user. I've proven that because if I explicitly invoke TIMEOUT using that qualification it still fails (to wait the timeout period).

    A quick test just now shows the exe seem to function correctly if run with admin privilege (if 3 or 4 runs can be said to be "proof"). The user my batch files (using CMD extn) are run in are std users.

    1 person found this answer helpful.
    0 comments No comments