How can I eliminate the"OK" prompt from a VB Script?

steve.marks59

Beta member
Messages
3
My OS is XP-Pro SP3

I use the VB Script shown below to quickly kill applications when I don't want them loading at startup. This VB Script seems to kill the applications much faster than running a batch file to start taskkill.exe. However I would rather not have to click the "OK" button prompted AFTER each application is terminated. Seems pointless anyway to be asked for an "OK" AFTER the application has been killed. Can this script be modified to eliminate the pointless prompts? I would not have ran the script in the first place if I did not want to kill the apps.

The popup window displays how many instances of the application it has killed and you have to click the "OK" button before the script will kill the next application or close.

This is the script:
Code:
strComputer = "."
strProcessToKill = "cmd.exe" 

Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" _ 
        & strComputer & "\root\cimv2") 

Set colProcess = objWMIService.ExecQuery _
        ("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")

count = 0
For Each objProcess in colProcess
        objProcess.Terminate()
        count = count + 1
Next 


wscript.echo "Killed " & count & " instances of " & _
        strProcessToKill & "on " & strComputer


strComputer = "."
strProcessToKill = "firefox.exe" 

Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" _ 
        & strComputer & "\root\cimv2") 

Set colProcess = objWMIService.ExecQuery _
        ("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")

count = 0
For Each objProcess in colProcess
        objProcess.Terminate()
        count = count + 1
Next 


wscript.echo "Killed " & count & " instances of " & _
        strProcessToKill & "on " & strComputer


strComputer = "."
strProcessToKill = "yahoomessenger.exe" 

Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" _ 
        & strComputer & "\root\cimv2") 

Set colProcess = objWMIService.ExecQuery _
        ("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")

count = 0
For Each objProcess in colProcess
        objProcess.Terminate()
        count = count + 1
Next 


wscript.echo "Killed " & count & " instances of " & _
        strProcessToKill & "on " & strComputer


Thanks.
 
Posted Today, 12:07 AM
PLEASE DISREGARD THIS THREAD MY PROBLEM WAS SOLVED ELSEWHERE.
ALL I HAD TO DO WAS COMMENT OUT THE THREE PLACES THESE TWO LINES APPEAR"

wscript.echo "Killed " & count & " instances of " & _
strProcessToKill & "on " & strComputer

IF I KNEW HOW I WOULD HAVE DELETED THIS THREAD SO I WOULD NOT WASTE ANYONE'S TIME.
 
You can't delete the thread which is a good thing - even though your particular problem is solved, someone might come searching here for a solution to a similar issue and then have this resolved by this thread. If we just deleted all threads that were "solved", this site would become a far less useful resource!
 
Back
Top Bottom