fredmastro
asked on
WScript.Shell Question
There's no Category for VBScript and or WScript or just Windows Scripting, so I'll ask it in here since I use ASP and I think someone here might know.
I'm using:
SET Comm = WScript.CreateObject("WScr ipt.Shell" )
Comm.Run("DOS Command here")
That's the code in my .vbs file for logon script.
Problem, when I run the .vbs file it opens a command prompt window to run the command, but then it leaves it open and contiues the script. Is there a way to close that command window or run the command a different way?
Thanks.
I'm using:
SET Comm = WScript.CreateObject("WScr
Comm.Run("DOS Command here")
That's the code in my .vbs file for logon script.
Problem, when I run the .vbs file it opens a command prompt window to run the command, but then it leaves it open and contiues the script. Is there a way to close that command window or run the command a different way?
Thanks.
you'll need to add a /c parameter in the command lint so that it'll close..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok having problems, but I'm trying this out different ways
ASKER
Thanks, just what I needed. Here's my actual code:
...
...
SET WinEn = Comm.Environment("PROCESS" )
ComSpec = WinEn("COMSPEC")
...
...
Function RunMe(COMMAND)
REM Run Shell Command
Comm.Run ComSpec & " /c " & COMMAND, 0, TRUE
End Function
...
...
So this will run my shell commands without showing a window and then it will close the command and the next one won't run until the previous one is done. Great!
Oh even though I used 0 to hide the command window I still have to use /c or it just sits there all day.
...
...
SET WinEn = Comm.Environment("PROCESS"
ComSpec = WinEn("COMSPEC")
...
...
Function RunMe(COMMAND)
REM Run Shell Command
Comm.Run ComSpec & " /c " & COMMAND, 0, TRUE
End Function
...
...
So this will run my shell commands without showing a window and then it will close the command and the next one won't run until the previous one is done. Great!
Oh even though I used 0 to hide the command window I still have to use /c or it just sits there all day.
Set comm = nothing..
Will that close the window/.