Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script to know whether an application is running from the task manager

Status
Not open for further replies.

anilreddygeeda

Programmer
Sep 23, 2009
4
US
Hello all....Guys please help me regarding a VBscript that tells whether an application is already running in the task manager. If it is running, it should not launch it again, If not, It has to launch it.....
 
Code:
strComputer = "."
strProcessName = "Notepad"

set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 
set colProcesses = objWMI.ExecQuery("Select * from Win32_Process Where Name='" & strProcessName & "'")

for each objProcess in colProcesses
	intProcessID = objProcess.ProcessID
next 

if (intProcessID) then wscript.echo "already running"

-Geates
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top