Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if a program is running by executable path

In powershell, how do I check if a program is running by using the full path of the program executable? Or do I need to parse the path to get the process name?

Thanks.

EDIT:

I need to know if the executable "C:\My Temporary Programs\Test 1.exe" is running.

like image 628
mcu Avatar asked Dec 17 '22 03:12

mcu


1 Answers

Try this:

get-process | ?{$_.path -eq $path}

So you can do something like:

if(get-process | ?{$_.path -eq "C:\My Temporary Programs\Test 1.exe"}){
    #exe is running. Do what you want
}
like image 178
manojlds Avatar answered Dec 24 '22 21:12

manojlds