使用VBScript静默运行EXE
我创建了一个脚本,它使用程序使用VBScript静默运行EXE,vbscript,Vbscript,我创建了一个脚本,它使用程序MousePos.exe检查空闲时间,并将响应推回到自身,以确定是否有任何鼠标移动。这一切都很好,但是每次运行MousePos.exe时,它都会在屏幕上闪烁,我想隐藏它。我不知道该怎么做,我原以为会很简单 有人建议我需要使用WshShell对象的Run方法,而不是wshscript exec对象,但我不知道如何执行此操作,仍然从EXE读取响应 Function execStdOut(cmd) Dim goWSH : Set goWSH = CreateObje
MousePos.exe
检查空闲时间,并将响应推回到自身,以确定是否有任何鼠标移动。这一切都很好,但是每次运行MousePos.exe
时,它都会在屏幕上闪烁,我想隐藏它。我不知道该怎么做,我原以为会很简单
有人建议我需要使用WshShell
对象的Run
方法,而不是wshscript exec
对象,但我不知道如何执行此操作,仍然从EXE读取响应
Function execStdOut(cmd)
Dim goWSH : Set goWSH = CreateObject("WScript.Shell")
Dim aRet: Set aRet = goWSH.Exec(cmd)
execStdOut = aRet.StdOut.ReadAll()
End Function
'wait 2 seconds for things to calm now
WScript.Sleep 2000
'get initial Mouse XY
MPOS = execStdOut("cmd /c C:\Windows\MousePos.exe")
WScript.Sleep 10000 '10 seconds
'set initial idle counter
Idle = 0
Do While forever = 0
OLD = MPOS
MPOS = execStdOut("cmd /c C:\Windows\MousePos.exe")
If OLD = MPOS Then
Idle = Idle + 1
If idle = 12 Then '12 x 10 seconds for 2 minute timeout
idle = 0
Set objShell = WScript.CreateObject("WScript.Shell")
objshell.Run "C:\Windows\IERestart_countdown.hta", 1, True
End If
Else
idle = 0
End If
WScript.Sleep 10000 ' 10 seconds
Loop
检查,检查。