How can I eliminate the

February 2, 2011 at 23:24:27
Specs: Windows XP, 2.0 GHz, 512MB
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:

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.


See More: How can I eliminate the

Report •


#1
February 3, 2011 at 00:12:13
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.


Report •
Related Solutions


Ask Question