WSH 5.6 WshShell.Exec - Minimized Window? 
Author Message
 WSH 5.6 WshShell.Exec - Minimized Window?

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.....



Fri, 24 Dec 2004 17:05:46 GMT  
 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")

Not possible, I am afraid. From a preivous thread:

<qoute>

Subject: Re: Mimimizing WshScriptExec Windows
Newsgroups: microsoft.public.scripting.VBScript
Date: 2001-09-27 19:14:40 PST

Nope...

If the script is executed via cscript.exe you won't get a secondary console
window (it will share
the existing console window).  But if you execute via wscript.exe, there isn't
any way to suppress
or otherwise hide that console window.

--
Michael Harris
Microsoft.MVP.Scripting

</qoute>

--
torgeir



Fri, 24 Dec 2004 19:32:32 GMT  
 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



Sat, 25 Dec 2004 00:03:58 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. WSH 5.6 Beta - Shell.Exec

2. wsh 5.6 beta 2 bug - floppy access during exec

3. WSH 5.6 Beta 1, new method, WScript.Exec

4. WSH 5.6 beta - Shell.Exec

5. WSH 5.6 b 1 Remote Exec

6. WshShell.Run vs WshShell.Exec

7. runas with WshShell.Exec versus WshShell.Run

8. WshShell.Exec without command prompt window?

9. Reinstalling WSH 5.6 on Windows XP

10. Windows XP and Wsh 5.6

11. WSH 5.6 and Windows 95

12. Availability of WSH 5.6 beta for Windows ME.

 

 
Powered by phpBB® Forum Software