Results 1 to 6 of 6

Thread: Close Command prompt using Vbscript

  1. #1

    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


  2. #2

    Re: Close Command prompt using Vbscript

    Try this:

    Sub cmdClose()
    Dim oCMD
    Set oCMD=GetObject("WSCript.shell")
    oCMD.Close
    Set oCMD=Nothing
    End Sub


  3. #3

    Re: Close Command prompt using Vbscript

    hei it is not working in my machine...I have XP...


  4. #4

    Re: Close Command prompt using Vbscript

    it is giving a runtime error..


  5. #5
    Junior Member
    Join Date
    Sep 2007
    Answers
    13

    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

    Last edited by ravisuriya; 01-17-2008 at 02:06 AM.

  6. #6

    Thumbs up Re: Close Command prompt using Vbscript

    Nice work man...
    GR8 work done...
    Its working.....


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact