Show EXE file path of running processes on the command-line in Windows

In addition to the line you gave, here are a bunch of lines that (apart from the second one) can be used to list paths:

PS C:\> gwmi win32_process | select Handle, CommandLine | format-list
PS C:\> gwmi win32_process | select name
PS C:\> gwmi win32_process | select CommandLine
C:\>wmic process get ProcessID,ExecutablePath
C:\>wmic process where "name='mysqld.exe'" get ProcessID, ExecutablePath
C:\>wmic process where "name='mysqld.exe'" get ProcessID, ExecutablePath /FORMAT:LIST

PowerShell to the rescue.

First I used Get-Member to see what Get-Process could return:

PowerShell Get-Process ^| Get-Member

Then I filtered the Path from Get-Process to figure out which Spring.Tests processes were running:

PowerShell Get-Process Spring.Tests ^| Format-List Path

resulting in:

Path : C:\Users\Developer\Versioned\Spring4D\Tests\Bin\DelphiXE\Spring.Tests.exe

which is exactly the information I wanted.


Pipe PowerShell's Get-Process into Select-Object.

Example command for Notepad++:

Get-Process notepad++ | Select-Object Path

Output:

Path
----
D:\Notepad++\notepad++.exe

Tags:

Windows