用批处理命令设置屏幕保护和电源的等待时间怎么写?

来源:百度知道 编辑:UC知道 时间:2024/05/16 18:43:46
用批处理命令设置屏幕保护和电源的等待时间怎么写?
每天睡觉前挂着机器下东西,为了不让别人乱搞,要先设置带密码的屏幕保护等待时间1分钟,显示器电源2分钟关闭。
然后起来后又要设置密码保护时间999分钟,显示器电源20分钟关闭,因为平时,用电脑的时候浏览网页,经常会出现1分钟不需要移动鼠标键盘而出现屏幕保护的情况。
请问有没有批处理文件,直接设置 屏保1分钟and电源2分钟,另外一个屏保999and电源20分钟。
windows XP sp2
千羽之城:
看到了你的更新,复制你提供的这个代码写好了一个新的VBS,但是执行之后依然弹出对话框,3行1字符错误无法创建“Wscript.Shell”对象,错误代码8007007E,源:Wscript.CreateObject。

纠结……

批处理很难满足你的要求,试试VBS吧:

Dim objShell

Set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.Run "rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1"

' 设置屏幕保护
'------------------------ Start --------------------------
Wscript.Sleep 2000
objShell.SendKeys("{home}")
Wscript.Sleep 500
objShell.SendKeys("{Down 1}")
Wscript.Sleep 500
objShell.SendKeys("{tab 3}")
Wscript.Sleep 500
objShell.SendKeys("20") ' 设置屏幕保护为1分钟
Wscript.Sleep 500
objShell.SendKeys("%p")
'------------------------ End --------------------------

' 设置电源和监视器
'------------------------ Start --------------------------
Wscript.Sleep 500
objShell.SendKeys("%o")
Wscript.Sleep 800
objShell.SendKeys("{home}")
Wscript.Sleep 500
objShell.SendKeys("%m")
Wscrip