1

I have a simple VBScript which writes stdOutput to a textfile using a loop.

The script works, however my problem is that a flashing a window appears on the screen each time the loop runs. I wish to stop that flashing window from appearing.

I am runnning the vbscript via windows cmd.exe.

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
Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
Ndy daniel
  • 77
  • 8

0 Answers0