VBScript – Terminate a specific process
Tagged Under : Process VBS, terminate, terminate process, VBScript
Version: 13.1
Revision: 22 Build 11
VBScript – Terminate a specific process
Introduction: when I was surfing my website and close “Firefox”, just to clear my temporary files and system caches, the browser’s process was stuck and I have to make a small ‘Vbscript’ to terminate the following process. This can be done by finding its process ID or its application name.
1.] Download notepad++ from the original author or from another source.
——————————-
http://sourceforge.net/projects/notepad-plus/
http://filehippo.com/download_notepad/
——————————-
2.] Copy this ‘VBScript’ source code and save it as “process_terminate.vbs” [without the quotes]. But, you can use other names if you want and keep the extension intact.
Terminate a process application by name.
—Copy Source Code—
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '<name>'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
—End Source Code—
Copyright 2001-2009 Lair360
Terminate a process application by id number.
—Copy Source Code—
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where ProcessID = <number>")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
—End Source Code—
Copyright 2001-2009 Lair360
Warning: please use this script carefully!
Any mistake could cause your computer – system to hang, crash or trigger errors.
3.] replace one of the script’s “name” or “number” to terminate a specific process.
4.] Execute the script!
5.] Done!







