Torgeir
Fri Oct 08 08:28:06 CDT 2004
Karen Middleton wrote:
> Whenever I run a Win32 console application it invariable starts a CMD
> prompt window eventhough this application is not a interactive
> application it is a command line application but starts a CMD prompt
> window.
>
> Can somebody please give me a VB Script that I can use to run this Win
> 32 executable to hide the CMD window from appearing.
>
> Thanks
> Karen
Hi
0 as the second parameter to the Run method will archive this:
'--------------------8<----------------------
Set oShell = CreateObject("WScript.Shell")
' add quotes around the path because of spaces in it
oShell.Run "cacls.exe ""c:\my test"" /E /G user:F", 0, True
'To redirect the output from cacls to a file (c:\logs\cacls.txt)
' you will need to use %comspec% /c:
oShell.Run "%comspec% /c cacls.exe ""c:\my test"" >c:\logs\cacls.txt", 0, True
'--------------------8<----------------------
The third parameter (True in the example above) will decide if the
script will wait for the command to finish before continuing.
WSH 5.6 documentation (local help file) can be downloaded
from here if you haven't got it already:
http://msdn.microsoft.com/downloads/list/webdev.asp
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx