Jump to content
Sign in to follow this  
eracross

* wildcards

Recommended Posts

eracross

What i want is to close all process with "name+any numbers.exe" like name1.exe, name2.exe.

$check = ProcessExists("name*.exe")
 
ProcessClose($check)

but not working any other way to do that?

Sry for my bad english.

Share this post


Link to post
Share on other sites
Malkey

This may help you.

Run("notepad.exe")
WinWaitActive("[CLASS:Notepad]")
Local $sString = "name"

Local $list = ProcessList()
For $i = 1 To $list[0][0]
    If StringRegExp($list[$i][0], "^note.*$") Then ProcessClose($list[$i][0])
    ;If StringRegExp($list[$i][0], "^" & $sString & "\d+\.exe$") Then ProcessClose($list[$i][0])
Next

; Note - ".*" in RE pattern, "." matches any character, and "*" causes the previous
;       character to be matched if repeated zero or many times.
;       "^" means beginning of string.
;       "$" means end of string. So using both "^" an "$" causes the entire string
;       to be compared, and not a matching sub-string.
;       StringRegExp() default parameter flag is zero which causes the return value
;       to be 1 or 0 only.
;       Regular expression are like an advanced evolved version of wildcards.
;
; To match "name+any numbers.exe" like name1.exe, name2.exe, try the RE pattern
; "^" & $sString & "\d+\.exe$", where $sString contains "name"

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.