前言:
新建记事本 改后缀 *.bat
复制下内容
1.关机
设置关机倒计时
@echo off echo 1 请输入多久后关机(秒) set /p answer= shutdown.exe -s -c "关机倒计时!" -t %answer%
写死关机倒计时
shutdown.exe -s -c "关机倒计时!" -t 10
立即关机
shutdown.exe -s -f
2.锁定计算机
rundll32.exe user32.dll,LockWorkStation
3.立即重启
shutdown.exe -lshutdown.exe -l
4.休眠
shutdown.exe -h
5.注销
bat版本
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit cd /d "%~dp0" shutdown.exe -l
vbs版本
Set colOperatingSystems = GetObject("winmgmts:{(Shutdown)}").ExecQuery("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems ObjOperatingSystem.Win32Shutdown(0) Next