MSFN Forum: Help: Determining if a process is running. - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Help: Determining if a process is running. Rate Topic: -----

#1 User is offline   edg21 

  • Member
  • PipPip
  • Group: Members
  • Posts: 196
  • Joined: 29-August 03

Posted 14 August 2004 - 05:48 AM

In my unattended CD I have spybot S&D install & schedule it to scan every 5 days. I want to be able to determine if a certain process is running & act accordingly. My problem is this... I have several computers that cannot be interrupted (scan would cause them to fail) while a certain process is running. I want a batch file to check for a certain process.. if it see's it I would like to remove & reschedule the scan. If it is not running I would like it to run the already scheduled task. Any help or suggestions would be appreciated.


#2 User is offline   Raja 

  • Newbie
  • Group: Members
  • Posts: 37
  • Joined: 09-July 04

Posted 14 August 2004 - 06:46 PM

Copy and paste the following in a .vbs file and see if this could be used for your needs. The script checks for if Notepad.exe is running or not.
Simply edit the Process name as per your requirement to check if the process is running or not.

CODE:

strProcess = "Notepad.exe"
Set objWMIService = GetObject("winmgmts:")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process where name='" & strProcess & "'")
CheckProcess=(colProcessList.Count > 0)
If CheckProcess = -1 Then
Msgbox "Notepad is running"
Else
Msgbox "Notepad is NOT running"
End If

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy