Obtaining a list of running processes and their associated PIDs

If you need to get a list of the processes running on a Microsoft Windows system and the process identifier (PID) for each of those processes, you can get the information from a command line interface (CLI), e.g., a command prompt, using the tasklist command as shown below:

Udemy Generic Category (English)120x600



C:\>tasklist

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
System Idle Process              0 Services                   0          4 K
System                           4 Services                   0     18,812 K
smss.exe                       368 Services                   0        668 K
csrss.exe                      600 Services                   0      3,964 K
csrss.exe                      684 RDP-Tcp#0                  1     10,332 K
wininit.exe                    704 Services                   0      1,596 K
winlogon.exe                   772 RDP-Tcp#0                  1     38,200 K
services.exe                   832 Services                   0      8,672 K
lsass.exe                      848 Services                   0     17,632 K
svchost.exe                    948 Services                   0     24,516 K
svchost.exe                   1020 Services                   0     18,604 K
dwm.exe                        528 RDP-Tcp#0                  1     72,576 K
svchost.exe                    624 Services                   0     84,956 K
svchost.exe                    812 Services                   0     59,440 K
svchost.exe                    824 Services                   0     70,988 K
svchost.exe                    536 Services                   0     30,652 K
svchost.exe                    920 Services                   0     22,960 K
svchost.exe                   1456 Services                   0     35,124 K
svchost.exe                   1464 Services                   0     13,408 K
WUDFHost.exe                  1472 Services                   0      4,004 K
svchost.exe                   1560 Services                   0     10,932 K
svchost.exe                   1832 Services                   0     10,880 K
spoolsv.exe                   2012 Services                   0     98,496 K
SASCore64.exe                 2176 Services                   0      1,204 K
svchost.exe                   2184 Services                   0      7,976 K
svchost.exe                   2192 Services                   0     14,576 K
svchost.exe                   2208 Services                   0     24,428 K
armsvc.exe                    2300 Services                   0      1,528 K
LavasoftTcpService.exe        2320 Services                   0     12,976 K
mqsvc.exe                     2624 Services                   0      5,712 K
svchost.exe                   2632 Services                   0      8,276 K
svchost.exe                   2684 Services                   0     22,540 K
SftService.exe                2900 Services                   0      2,928 K
svchost.exe                   2912 Services                   0     12,032 K
Memory Compression            3116 Services                   0    120,808 K
svchost.exe                   3836 Services                   0      9,756 K
dasHost.exe                   4024 Services                   0      3,636 K
SMSvcHost.exe                 4300 Services                   0        648 K
cygrunsrv.exe                 5704 Services                   0        944 K
conhost.exe                   6036 Services                   0      1,692 K
sshd.exe                      5528 Services                   0      4,732 K
svchost.exe                   6728 RDP-Tcp#0                  1     23,644 K
taskhostw.exe                 6752 RDP-Tcp#0                  1     16,272 K
sihost.exe                    6792 RDP-Tcp#0                  1     22,576 K
itype.exe                     7036 RDP-Tcp#0                  1      5,652 K
ipoint.exe                    7096 RDP-Tcp#0                  1      6,020 K
RuntimeBroker.exe             6868 RDP-Tcp#0                  1     79,292 K
explorer.exe                  6300 RDP-Tcp#0                  1    210,164 K
ShellExperienceHost.exe       7620 RDP-Tcp#0                  1     69,820 K
SearchIndexer.exe             8260 Services                   0     41,536 K
AdAwareTray.exe              10624 RDP-Tcp#0                  1     12,380 K
igfxtray.exe                 10672 RDP-Tcp#0                  1      5,696 K
hkcmd.exe                    10776 RDP-Tcp#0                  1      4,248 K
igfxpers.exe                 10880 RDP-Tcp#0                  1      7,140 K
netsession_win.exe           10956 RDP-Tcp#0                  1      4,500 K
netsession_win.exe           11004 RDP-Tcp#0                  1     14,152 K
fontdrvhost.exe              11100 RDP-Tcp#0                  1     11,280 K
RoxioBurnLauncher.exe        11056 RDP-Tcp#0                  1      5,392 K
acrotray.exe                 10760 RDP-Tcp#0                  1      3,284 K
ClamTray.exe                 11048 RDP-Tcp#0                  1      8,596 K
hpwuschd2.exe                11324 RDP-Tcp#0                  1      4,536 K
McPvTray.exe                 10896 RDP-Tcp#0                  1      5,268 K
NOBuAgent.exe                11540 Services                   0      6,728 K
NOBuClient.exe                6984 RDP-Tcp#0                  1      7,256 K
QBIDPService.exe             15132 Services                   0      1,884 K
dllhost.exe                  10320 RDP-Tcp#0                  1      7,972 K
ApplicationFrameHost.exe     14468 RDP-Tcp#0                  1     20,364 K
SearchUI.exe                 10904 RDP-Tcp#0                  1    128,828 K
OSPPSVC.EXE                   2852 Services                   0      8,692 K
SkypeHost.exe                13824 RDP-Tcp#0                  1      3,036 K
svchost.exe                   9560 Services                   0      6,636 K
SeaPort.EXE                   3960 Services                   0      7,596 K
taskhostw.exe                 2104 RDP-Tcp#0                  1     10,524 K
QBW32.EXE                     9008 RDP-Tcp#0                  1     89,740 K
splwow64.exe                 13668 RDP-Tcp#0                  1     14,664 K
SystemSettingsBroker.exe     12868 RDP-Tcp#0                  1      3,744 K
MCVULA~1.EXE                 14860 RDP-Tcp#0                  1      2,732 K
WmiPrvSE.exe                 13604 Services                   0     22,264 K
ModuleCoreService.exe         9320 Services                   0     21,012 K
ModuleCoreService.exe         5156 RDP-Tcp#0                  1     20,184 K
conhost.exe                  11652 RDP-Tcp#0                  1      2,000 K
AcroRd32.exe                  5936 RDP-Tcp#0                  1     20,304 K
AcroRd32.exe                 14444 RDP-Tcp#0                  1    137,596 K
McCSPServiceHost.exe         15332 Services                   0     20,084 K
PEFService.exe                5896 Services                   0      7,916 K
mfemms.exe                    6956 Services                   0      7,564 K
mfevtps.exe                  13500 Services                   0     17,140 K
mfevtps.exe                  13800 Services                   0      6,400 K
mcshield.exe                 15304 Services                   0     90,272 K
mfefire.exe                   2464 Services                   0      8,564 K
mcapexe.exe                   6900 Services                   0     11,756 K
McSvHost.exe                 15420 Services                   0     18,552 K
mfefire.exe                   4692 Services                   0      6,484 K
mcsacore.exe                  7940 Services                   0      5,356 K
svchost.exe                   5000 Services                   0      7,900 K
Microsoft.Photos.exe         10700 RDP-Tcp#0                  1    177,528 K
LockAppHost.exe              13796 RDP-Tcp#0                  1     21,376 K
McUICnt.exe                  16124 RDP-Tcp#0                  1     88,076 K
OneDrive.exe                 12468 RDP-Tcp#0                  1     27,740 K
WmiPrvSE.exe                 13704 Services                   0     12,656 K
sppsvc.exe                    3376 Services                   0     13,256 K
TrustedInstaller.exe         15564 Services                   0      7,972 K
TiWorker.exe                  3276 Services                   0      8,816 K
backgroundTaskHost.exe       11196 RDP-Tcp#0                  1     36,680 K
svchost.exe                  14784 Services                   0      6,644 K
csrss.exe                     7292 Console                    3      4,020 K
winlogon.exe                 16192 Console                    3      6,876 K
rdpclip.exe                  13136 RDP-Tcp#0                  1     11,772 K
LogonUI.exe                  13240 Console                    3     58,448 K
dwm.exe                      11852 Console                    3     22,448 K
backgroundTaskHost.exe       12000 RDP-Tcp#0                  1     21,556 K
taskhostw.exe                10452 Services                   0      7,536 K
dllhost.exe                   1944 Services                   0      9,804 K
McClientAnalytics.exe        11872 Services                   0     20,908 K
dllhost.exe                  13836 RDP-Tcp#0                  1     11,764 K
smartscreen.exe              12136 RDP-Tcp#0                  1     14,756 K
cmd.exe                      16128 RDP-Tcp#0                  1      2,892 K
backgroundTaskHost.exe        2036 RDP-Tcp#0                  1     33,332 K
conhost.exe                   6420 RDP-Tcp#0                  1     11,972 K
tasklist.exe                  1436 RDP-Tcp#0                  1      7,980 K

C:\>

Alternatively, you can use a Windows Management Instrumentation Command-line (WMIC) command as shown below:





C:\>WMIC PROCESS GET name, processid
Name                      ProcessId
System Idle Process       0
System                    4
smss.exe                  368
csrss.exe                 600
csrss.exe                 684
wininit.exe               704
winlogon.exe              772
services.exe              832
lsass.exe                 848
svchost.exe               948
svchost.exe               1020
dwm.exe                   528
svchost.exe               624
svchost.exe               812
svchost.exe               824
svchost.exe               536
svchost.exe               920
svchost.exe               1456
svchost.exe               1464
WUDFHost.exe              1472
svchost.exe               1560
svchost.exe               1832
spoolsv.exe               2012
SASCore64.exe             2176
svchost.exe               2184
svchost.exe               2192
svchost.exe               2208
armsvc.exe                2300
LavasoftTcpService.exe    2320
mqsvc.exe                 2624
svchost.exe               2632
svchost.exe               2684
SftService.exe            2900
svchost.exe               2912
Memory Compression        3116
svchost.exe               3836
dasHost.exe               4024
SMSvcHost.exe             4300
cygrunsrv.exe             5704
conhost.exe               6036
sshd.exe                  5528
svchost.exe               6728
taskhostw.exe             6752
sihost.exe                6792
itype.exe                 7036
ipoint.exe                7096
RuntimeBroker.exe         6868
explorer.exe              6300
ShellExperienceHost.exe   7620
SearchIndexer.exe         8260
AdAwareTray.exe           10624
igfxtray.exe              10672
hkcmd.exe                 10776
igfxpers.exe              10880
netsession_win.exe        10956
netsession_win.exe        11004
fontdrvhost.exe           11100
RoxioBurnLauncher.exe     11056
acrotray.exe              10760
ClamTray.exe              11048
hpwuschd2.exe             11324
McPvTray.exe              10896
NOBuAgent.exe             11540
NOBuClient.exe            6984
QBIDPService.exe          15132
dllhost.exe               10320
ApplicationFrameHost.exe  14468
SearchUI.exe              10904
OSPPSVC.EXE               2852
SkypeHost.exe             13824
svchost.exe               9560
SeaPort.EXE               3960
taskhostw.exe             2104
QBW32.EXE                 9008
splwow64.exe              13668
SystemSettingsBroker.exe  12868
MCVULA~1.EXE              14860
WmiPrvSE.exe              13604
ModuleCoreService.exe     9320
ModuleCoreService.exe     5156
conhost.exe               11652
AcroRd32.exe              5936
AcroRd32.exe              14444
McCSPServiceHost.exe      15332
PEFService.exe            5896
mfemms.exe                6956
mfevtps.exe               13500
mfevtps.exe               13800
mcshield.exe              15304
mfefire.exe               2464
mcapexe.exe               6900
McSvHost.exe              15420
mfefire.exe               4692
mcsacore.exe              7940
svchost.exe               5000
Microsoft.Photos.exe      10700
LockAppHost.exe           13796
OneDrive.exe              12468
WmiPrvSE.exe              13704
TrustedInstaller.exe      15564
TiWorker.exe              3276
backgroundTaskHost.exe    11196
svchost.exe               14784
csrss.exe                 7292
winlogon.exe              16192
rdpclip.exe               13136
LogonUI.exe               13240
dwm.exe                   11852
backgroundTaskHost.exe    12000
McClientAnalytics.exe     11872
smartscreen.exe           12136
cmd.exe                   16128
conhost.exe               6420
SearchProtocolHost.exe    8952
SearchFilterHost.exe      13064
audiodg.exe               16096
mcupdate.exe              15428
McUICnt.exe               3560
WMIC.exe                  2472


C:\>

If you wish to filter the output so that you only see information for a specific process, you can use the /fi option for the tasklist command. E.g., if I only wanted to determine the PID for the QuickBooks QBW32.exe process, I could use the command below:

C:\>tasklist /fi "imagename eq QBW32.exe"

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
QBW32.EXE                     9008 RDP-Tcp#0                  1     89,740 K

C:\Users\Pamela>

With WMIC, you can include a "where" option as shown below:

C:\>wmic process where name='QBW32.exe' get name, processid
Name       ProcessId
QBW32.EXE  9008


C:\>

Or, since I already know the process name, if I just want to see the PID, I could use commands like those shown below:

C:\>wmic process where name='QBW32.exe' get processid
ProcessId
9008


C:\>wmic process where name='QBW32.exe' get processid /Value


ProcessId=9008




C:\>