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.....
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"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.