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

2025-02-24 04:57:17
推荐回答(3个)
回答1:

批处理很难满足你的要求,试试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")
Wscript.Sleep 500
objShell.SendKeys("{up 5}") ' 设置关闭电源时间为2分钟
Wscript.Sleep 500
objShell.SendKeys("%a")
Wscript.Sleep 500
objShell.SendKeys("{enter}")
'------------------------ End --------------------------

Wscript.Sleep 500
objShell.SendKeys("%a")
Wscript.Sleep 500
objShell.SendKeys("{enter}")

Set objShell = Nothing

【更新】to 玩固分子:

在我这已经测试成功,错误代码8007007E,以下论坛有述及{二楼}:http://support.genopro.com/Topic17558-86-1.aspx

其中的“The specified module could not be found”即是错误代码的解释,翻译过来:未找到指定模块。这说你电脑的VBS运行环境出错,或者丢失了相应文件。安装以下文件:

http://www.microsoft.com/downloads/details.aspx?familyid=47809025-D896-482E-A0D6-524E7E844D81&displaylang=en

或者,开始--运行--输入:regsvr32 scrrun.dll{回车}

回答2:

谁说批处理不能去http://www.cn-dos.net/forum/forumdisplay.php?fid=23
这个专业论坛里面什么东东都有……多搜索

回答3:

批处理不能吧……