其实如果手快,可以直接输入命令行指令定时关机。
如果不想输入长指令,可以用这个懒人脚本,把代码存成.bat文件就可以执行,只需要输入分钟数就能倒计时关机,不受程序阻止影响。
@echo off
REM Prompt for minutes using PowerShell input dialog
setlocal enabledelayedexpansion
for /f "delims=" %%i in ('powershell -NoProfile -Command "Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.Interaction]::InputBox('Please enter shutdown delay in minutes:', 'Shutdown Timer', '10')"') do set mins=%%i
REM Validate input
set /a test=%mins% >nul 2>&1
if "%mins%"=="" (
echo [ERROR] No input. Aborted.
pause
exit /b
)
if errorlevel 1 (
echo [ERROR] Invalid input. Numbers only.
pause
exit /b
)
if %mins% LSS 1 (
echo [ERROR] Please enter a positive integer.
pause
exit /b
)
set /a seconds=%mins%*60
REM Schedule forced shutdown
shutdown /s /f /t %seconds%
echo [INFO] Shutdown scheduled in %mins% minute(s) (%seconds% seconds).
echo [INFO] To cancel, open CMD and run: shutdown /a
pause
有点意思
@nowatanono #1 他这是win用的
感谢
@pai50288 #2
原来如此 太少用win的自动开关机了没反应过来