Jump to content

Recommended Posts

Posted

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?

Posted

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

Posted
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!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...