写个windos自动关机代码
以下是 PowerShell 脚本,可以自动关机 Windows 系统:
# 设置关机时间(5分钟后关机)
$shutdownTime = (Get-Date).AddMinutes(5)
# 延迟关机
shutdown.exe /s /t 300
# 或者直接关机
# shutdown.exe /s /f /t 0
将上述代码保存为后缀为 .ps1 的文件,然后使用 PowerShell 运行即可。注意要以管理员身份运行 PowerShell。
原文地址: https://www.cveoy.top/t/topic/bctD 著作权归作者所有。请勿转载和采集!