Sri*_*ivi 12 vbscript automation
机器在自动化脚本运行时被锁定,这是因为不同脚本之间存在很长的间隔(由于某些原因,这是必需的).我想避免这种自动锁定功能.问题是,根据安全策略,我们无法从控制面板禁用此功能.有没有其他方法可以保持系统解锁?
st0*_*0le 18
我这样做了......它快速发送2个SCROLLLOCK键,所以它不会干扰(好吧,不管怎么说都不严重)任何应用程序.它每隔60秒就会这样做....干杯!
set wsc = CreateObject("WScript.Shell")
Do
WScript.Sleep (60*1000)
wsc.SendKeys ("{SCROLLLOCK 2}")
Loop
Run Code Online (Sandbox Code Playgroud)
小智 5
我使用一对文件...
第一个文件 (Keep_Awake__start.vbs) 保持唤醒/解锁状态。第二个文件 (Keep_Awake__end.vbs) 在您想返回到正常进程时方便地终止进程。
第一个文件...
' Keep_Awake__start.vbs
' Graham Edwards
' Typical stored in Start Menu
'
' Use Keep_Awake__start.vbs to keep the computer from inactivity-based lockouts.
' Use Keep_Awake__end.vbs to remove Keep_Awake__start.vbs
' Largely pulled from st0le response
' Http://stackoverflow.com/questions/4457907/how-to-prevent-auto-locking-feature-of-an-xp-machine-using-vbscript
' --- Define Object
set wsc = CreateObject("WScript.Shell")
' --- Loop every so many minutes and change the scroll lock setting
Do
' Wait for ~2 minutes
WScript.Sleep (2*60*1000)
wsc.SendKeys ("{SCROLLLOCK 2}")
Loop
Run Code Online (Sandbox Code Playgroud)
第二个文件...
' Keep_Awake__end.vbs
' Graham Edwards
' Use Keep_Awake__start.vbs to keep the computer from inactivity-based lockouts.
' Use Keep_Awake__end.vbs to remove Keep_Awake__start.vbs
' Largely pulled from Ansgar Wiechers response
' http://stackoverflow.com/questions/22324899/kill-a-vbscript-from-another-vbscript
' --- Define Object
Set wmi = GetObject("winmgmts://./root/cimv2")
' --- Search and Destroy
qry = "SELECT * FROM Win32_Process WHERE Name='wscript.exe' AND NOT " & _
"CommandLine LIKE '%" & Replace(WScript.ScriptFullName, "\", "\\") & "%'"
For Each p In wmi.ExecQuery(qry)
p.Terminate
Next
' --- Clean up
Set wmi = Nothing ' Release the Application object
Run Code Online (Sandbox Code Playgroud)
这些文件既可以从常规文本编辑器创建,也可以存储在任何地方(如桌面)。使用 .vbs 文件扩展名保存文件后,它就可以执行了。因此,您只需双击文件图标即可开始或结束(取决于您双击的文件)。
您可以将 Keep_Awake__start.vbs 存储在 Windows 启动文件夹中,以便在您登录后立即启动。
| 归档时间: |
|
| 查看次数: |
57473 次 |
| 最近记录: |