
WSH 5.6 WshShell.Exec - Minimized Window?
Quote:
> Does anyone know how to suppress the dos / command / prompt window
from
> popping up using the WshShell.Exec method?
> It is possible in the WshShell.Run method:
> WshShell.Run(strCommand, [intWindowStyle], [bWaitOnReturn])
> Set oExecRexec = WshShell.Exec("MyApp.exe")
> Thanks in advance.....
As Torgeir noted, not possible...
Here's a wrapper I use around WScript.Shell's Run method which is
similar to what a few other people here have done.
sData = Cmd("ipconfig")
Function Cmd(cmdline)
' Wrapper for getting StdOut from a console command
Dim Sh, FSO, fOut, OutF, sCmd
Set Sh = createobject("WScript.Shell")
Set FSO = createobject("Scripting.FileSystemObject")
fOut = FSO.GetTempName
sCmd = "%COMSPEC% /c " & cmdline & " >" & fOut
Sh.Run sCmd, 0, True
If FSO.FileExists(fOut) Then
If FSO.GetFile(fOut).Size>0 Then
Set OutF = FSO.OpenTextFile(fOut)
Cmd = OutF.Readall
OutF.Close
End If
FSO.DeleteFile(fOut)
End If
End Function