阻止VBScript exec在屏幕上闪烁

时间:2017-10-14 12:18:39

标签: cmd vbscript

我有一个简单的VBScript,它使用循环将stdOutput写入文本文件。

该脚本有效,但我的问题是每次循环运行时屏幕上都会出现一个闪烁的窗口。我希望阻止那个闪烁的窗口出现。

我通过windows cmd.exe运行vbscript。

Set sh = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

Dim counter, myNum, fileLine, outFile, objFile 
myNum = 0
counter = 90

outFile = "netband_logger_vbs.tmp"
Set objFile = objFSO.CreateTextFile(outFile, True)

Do While myNum < counter
    myNum = myNum + 1
    Call GetConnections()
Loop

Function GetConnections()
    i = 0
    Set shExec = sh.Exec("netstat -e")
    Do While Not shExec.StdOut.AtEndOfStream
        fileLine = shExec.StdOut.ReadLine()
        objFile.Write fileLine & vbCrLf
    Loop
    objFile.Close
End Function

0 个答案:

没有答案