name_lock 为自建任务名称,修改并不影响执行效果
锁屏命令也可以替换成其他命令或.bat|.exe|.txt 等格式的文件
指定时间 18:00 锁屏
@echo off
schtasks /create /TN name_lock /ST 18:00 /sc once /TR "rundll32.exe user32.dll,LockWorkStation"
指定每间隔 60 分钟锁屏
@echo off
schtasks /create /TN name_lock /sc minute /mo 60 /TR "rundll32.exe user32.dll,LockWorkStation"
删除指定任务 name_lock
@echo off
schtasks /delete /TN name_lock
参考信息:
https://docs.microsoft.com/zh-cn/windows-server/administration/windows-commands/schtasks-create