Close Command prompt using Vbscript
How to close the Command prompt using Vbscript
Using batch file i am opening the any application by mentioning the path but that application is opening along with command prompt also showing. please let me know how to close the command prompt not an application
Re: Close Command prompt using Vbscript
Try this:
Sub cmdClose()
Dim oCMD
Set oCMD=GetObject("WSCript.shell")
oCMD.Close
Set oCMD=Nothing
End Sub
Re: Close Command prompt using Vbscript
hei it is not working in my machine...I have XP...
Re: Close Command prompt using Vbscript
it is giving a runtime error..
Re: Close Command prompt using Vbscript
Friends,
This works for me on using it after writing the script for closing all the unwanted application. Let me know, for your testing it helps or not. I am waiting...
Set oShell = CreateObject("WScript.Shell")
Set oWmg = GetObject("winmgmts:")
strWndprs = "select * from Win32_Process where name='cmd.exe'"
Set objQResult = oWmg.Execquery(strWndprs)
For Each objProcess In objQResult
intReturn = objProcess.Terminate(1)
Next
Re: Close Command prompt using Vbscript
Nice work man...
GR8 work done...
Its working.....:D:cool: