Dav*_*ill 15
我认为无法确定何时关闭。
您可以使用以下算法确定是否安排了关机:
运行使用“测试”关机shutdown /t xxx
用的时间大的值。
如果已经有关闭挂起,shutdown /t xxx
则将失败并显示错误级别1190
:
已安排系统关闭。(1190)
如果您没有收到上述错误,那么您就知道之前没有计划关闭,因此您需要使用shutdown /a
.
以上可以在批处理文件中完成:
@echo off
rem perform a "test" shutdown with a large time
shutdown /t 999999
rem if there is already a shutdown pending then %ERRORLEVEL% will be 1190
if %ERRORLEVEL% equ 1190 (
echo A shutdown is pending
) else (
rem cancel the "test" shutdown
shutdown /a
echo No shutdown is pending
)
Run Code Online (Sandbox Code Playgroud)
笔记:
归档时间: |
|
查看次数: |
23323 次 |
最近记录: |