+ Post New Thread
Results 1 to 3 of 3
Scripts Thread, Is Process Running in Coding and Web Development; Does anybody have a script which checks if a process is running and does an output depending on that? I.e ...
  1. #1

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,816
    Thank Post
    272
    Thanked 1,138 Times in 1,034 Posts
    Rep Power
    350

    Is Process Running

    Does anybody have a script which checks if a process is running and does an output depending on that?

    I.e - is xx.exe running - no do this yes do that?

    I know how to do it for If Exist etc but is it possible?

    If *something* process.exe goto ABC else goto EFG

    any ideas?

  2. #2

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,697
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Code:
    Do
    
    set service = GetObject ("winmgmts:")
    pFound = False
    
    	
    	for each Process in Service.InstancesOf ("Win32_Process")
    		If Process.Name = "notepad.exe" then
              		pFound = True
    		End If
    	next
    
    	If pFound = true then
    		Wscript.echo "Yes"
    	end if
    
    Loop
    That kind of thing?

    Steve

  3. #3

    glennda's Avatar
    Join Date
    Jun 2009
    Location
    Sussex
    Posts
    7,816
    Thank Post
    272
    Thanked 1,138 Times in 1,034 Posts
    Rep Power
    350
    Erm yes - although I have just realised i could simply do - taskkill process.exe then do what i want to do anyway as it doesn't make a difference if the process is killed before what i need to do!

SHARE:
+ Post New Thread

Similar Threads

  1. Is anyone running a school radio?
    By Jake in forum How do you do....it?
    Replies: 16
    Last Post: 13th April 2013, 02:36 PM
  2. Sysprep is already running
    By jack0w in forum O/S Deployment
    Replies: 0
    Last Post: 9th April 2010, 10:44 AM
  3. Multiple rundll32 process running
    By freaky_seb in forum Windows
    Replies: 3
    Last Post: 19th June 2009, 02:05 PM
  4. Replies: 15
    Last Post: 1st June 2008, 08:09 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •