How to print the list of running processes, in Windows

The tasklist command will output a list of all running processes. You can redirect it to a text file with tasklist > filename.txt and then print that file using Notepad or any other program that handles text files.


In PowerShell you could use: get-process or get-wmiobject WIN32_PROCESS.

Ok, but can PowerShell show more details? More than CMD tasklist?

  • get-process | format-table -property * -autosize
  • gps | ft * -auto (same command, but shorter version)
  • get-wmiobject WIN32_PROCESS | format-table -property * -autosize
  • gwmi WIN32_PROCESS | ft * -auto (same command, but shorter version)

Uh, thats too much detail. Can I select the columns I need?

  • gps | ft name,ID,sessionID,basepriority,priorityClass,path -auto
  • gwmi WIN32_PROCESS | ft name,processID,priority,CommandLine -auto

Ah, better. But some columns are truncated. I can avoid this by saving to file, right?

  • gps | ft * -auto | Out-File D:\process-list.txt -Width 4096
  • gwmi WIN32_PROCESS | ft * -auto | Out-File D:\process-list.txt -Width 4096

Wonderful. What about printing it directly?

  • gps | ft * -auto | Out-Printer
  • gwmi WIN32_PROCESS | ft * -auto | Out-Printer

Can I also export them as CSV ?

  • gps | select * | Export-Csv D:\process-list.csv
  • gwmi WIN32_PROCESS | select * | Export-Csv D:\process-list.csv

Oh thats cool. Can I sort the output by memory or CPU usage?

gwmi WIN32_PROCESS | Sort ws -desc | ft name, @{Name="Mem Usage (KB)";Expression={[math]::round($_.ws / 1kb)}} -auto
gwmi Win32_PerfFormattedData_PerfProc_Process | sort PercentProcessorTime -desc| ft name, PercentProcessorTime -auto

All commands are fully explained on SS64.com together with some examples and available aliases.