Jump to content

help to ProcessExists


harvey
 Share

Recommended Posts

hello everybody.

i want to check multi ProcessExists name's i tried that but it's not working

If ProcessExists("newfolder.exe"scvhost.exe"ognlfa.exe"qimpkc.exe"mbhqku.exe"kwafva.exe"jdsnhs.exe"fkctn.exe") Then
        MsgBox(0, "Example", "newfolder virus is running.")
ProcessClose("newfolder.exe"scvhost.exe"ognlfa.exe"qimpkc.exe"mbhqku.exe"kwafva.exe"jdsnhs.exe"fkctn.exe")
    Else
        MsgBox(0, "Example", "your pc clean.")
    EndIf

btw i know that i can use this code but i look for any way look like previous way

If ProcessExists("newfolder.exe") Then
  ProcessClose("newfolder.exe")
EndIf
  If ProcessExists("scvhost.exe") Then
  ProcessClose("scvhost.exe")
EndIf
        If ProcessExists("ognlfa.exe") Then
  ProcessClose("ognlfa.exe")
EndIf

thx in advanced

Edited by harvey
Link to comment
Share on other sites

Have a look at Process List

; List all processes
Local $list = ProcessList()
For $i = 1 To $list[0][0]
    MsgBox(0, $list[$i][0], $list[$i][1])
Next

Maybe you could read the outputs in an array then check them against your list

Link to comment
Share on other sites

Make an array containing your processes

Dim $aProcesses[10] = ["newfolder.exe", "svchost.exe",....]

Then use a For Loop

For $n = 0 To UBound( $aProcesses ) - 1
If ProcessExists( $aProcesses[$n] ) Then
  ProcessClose( $aProcesses[$n] )
EndIf
Next

#EDIT

by the way: Closing svchost.exe causes the system to crash

Edited by jWalker
Link to comment
Share on other sites

@Chimaera

thx for your help i tried that before i post this topic but it's not working

Local $list = ProcessList("newfolder.exe", "scvhost.exe", "mbhqku.exe", "kwafva.exe")
For $i = 1 To $list[0][0]
    MsgBox(0, $list[$i][0], $list[$i][1])
Next

@jWalker

thx for your help that's what i wanted.but i faced problem when i try to use (else) in my script

anyway this is asimple of what i trying to make

Dim $aProcesses [10] = ["newfolder.exe", "scvhost.exe", "mbhqku.exe", "kwafva.exe"]
For $n = 0 To UBound( $aProcesses ) - 1
  if Not ProcessExists( $aProcesses[$n] ) Then
        MsgBox(0, "result", "your pc clean.")
Else
If ProcessExists( $aProcesses[$n] ) Then
ProcessClose( $aProcesses[$n] )
FileSetAttrib (@WindowsDir & "newfolder.exe" ,"-RSH")
FileDelete(@WindowsDir & "newfolder.exe")
FileSetAttrib (@WindowsDir & "scvhost.exe" ,"-RSH")
FileDelete(@WindowsDir & "scvhost.exe")
FileSetAttrib (@WindowsDir & "mbhqku.exe" ,"-RSH")
FileDelete(@WindowsDir & "mbhqku.exe")
EndIf
MsgBox(0, "result", "files deleted.")
EndIf
Next

i made an .exe and i renamed it new folder in windows to test my script

but the massage of (your pc clean) appeared about 10 times so any suggestion to solve that

btw this is my first script in this great language and i searched about Dim $aProcesses array in help file but i didn't get info so I'm sorry for my noob question

Edited by harvey
Link to comment
Share on other sites

@Chimaera

thx for your help i tried that before i post this topic but it's not working

Local $list = ProcessList("newfolder.exe", "scvhost.exe", "mbhqku.exe", "kwafva.exe")
For $i = 1 To $list[0][0]
    MsgBox(0, $list[$i][0], $list[$i][1])
Next

@jWalker

thx for your help that's what i wanted.but i faced problem when i try to use (else) in my script

anyway this is asimple of what i trying to make

Dim $aProcesses [10] = ["newfolder.exe", "scvhost.exe", "mbhqku.exe", "kwafva.exe"]
For $n = 0 To UBound( $aProcesses ) - 1
  if Not ProcessExists( $aProcesses[$n] ) Then
        MsgBox(0, "result", "your pc clean.")
Else
If ProcessExists( $aProcesses[$n] ) Then
ProcessClose( $aProcesses[$n] )
FileSetAttrib (@WindowsDir & "\newfolder.exe" ,"-RSH")
FileDelete(@WindowsDir & "\newfolder.exe")
FileSetAttrib (@WindowsDir & "\scvhost.exe" ,"-RSH")
FileDelete(@WindowsDir & "\scvhost.exe")
FileSetAttrib (@WindowsDir & "\mbhqku.exe" ,"-RSH")
FileDelete(@WindowsDir & "\mbhqku.exe")
EndIf
MsgBox(0, "result", "files deleted.")
EndIf
Next

i made an .exe and i renamed it new folder in \windows to test my script

but the massage of (your pc clean) appeared about 10 times so any suggestion to solve that

btw this is my first script in this great language and i searched about Dim $aProcesses array in help file but i didn't get info so I'm sorry for my noob question

You can try learning from this task manager I've been making, I put it together from a few scripts I've found made by some of the forums most insightful.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...