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

windows

How can I show the full EXE file path of each running process from the command-line in Windows?

I've tried tasklist and pslist, but they don't show the full path:

tasklist /FI "ImageName eq Spring.Tests.exe" /v /fo List

Gives:

Image Name:   Spring.Tests.exe
PID:          3956
Session Name: Console
Session#:     1
Mem Usage:    9,772 K
Status:       Running
User Name:    W81ENTX64DELPHI\Developer
CPU Time:     0:00:01
Window Title: Spring

and

pslist Spring.Tests -x

gives:

Name                Pid      VM      WS    Priv Priv Pk   Faults   NonP Page
Spring.Tests       3956   83472    9772    5320    5692     5037     11  157
 Tid Pri    Cswtch            State     User Time   Kernel Time   Elapsed Time
1488  10     11018     Wait:UserReq  0:00:00.906   0:00:01.046    0:53:06.977

Since Spring.Tests.exe can be in various directories, I want to know which one was executed.

Best Answer

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
Related Question