问题描述
我一直在挑战自己,以尽可能少的字符来重写我的一个批处理项目,并且开始怀疑-t是否有任何用途。
显然,以下两个脚本在执行时的行为都完全相同。
timeout -t 5
echo test
pause
timeout 5
echo test
pause
Microsoft文档(https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/timeout_1)和ss64(https://ss64.com/nt/timeout.html)均未提及-t是否必要。
解决方法
Flutter sends WebSocket key.
Key sent back by ESP...
Message from App:
⸮⸮uD⸮ZD⸮⸮⸮⸮□⸮⸮□⸮
命令自己的timeout
帮助在括号中显示/?
,表明它是可选的。
[/T]
给定无效参数时显示的错误消息也会提及C:\>timeout /?
TIMEOUT [/T] timeout [/NOBREAK]
Description:
This utility accepts a timeout parameter to wait for the specified
time period (in seconds) or until any key is pressed. It also
accepts a parameter to ignore the key press.
...
,无论是否在命令行上实际指定了它。
/T
可选的C:\>timeout ***
ERROR: Invalid value for timeout (/T) specified. Valid range is -1 to 99999.
开关可能是为了向后兼容,因为随NT4 / 2000资源工具包发布的/T
的早期版本没有timeout
作为开关。例如,这是 Windows 2000 Server资源工具包补充1 中的/T
。
timeout.exe