Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/95.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用VBScript静默运行EXE_Vbscript - Fatal编程技术网

使用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
检查,检查。