44

On Windows, in the Task Manager it is possible to see the command line of each processes but it is truncated.

How can I see the complete command line of each running process?

0

3 Answers 3

75

In cmd, run the following:

wmic process get processid,commandline

To filter for a particular program:

wmic process where "name like '%chrome%'" get processid,commandline

Note: This generally does not require Administrator privileges - however, you will need Administrator privileges to view the full information for processes not running under your user account.

The other properties that you can query for processes are:

  • Caption
  • CommandLine
  • CreationClassName
  • CreationDate
  • CSCreationClassName
  • CSName
  • Description
  • ExecutablePath
  • ExecutionState
  • Handle
  • HandleCount
  • InstallDate
  • KernelModeTime
  • MaximumWorkingSetSize
  • MinimumWorkingSetSize
  • Name
  • OSCreationClassName
  • OSName
  • OtherOperationCount
  • OtherTransferCount
  • PageFaults
  • PageFileUsage
  • ParentProcessId
  • PeakPageFileUsage
  • PeakVirtualSize
  • PeakWorkingSetSize
  • Priority
  • PrivatePageCount
  • ProcessId
  • QuotaNonPagedPoolUsage
  • QuotaPagedPoolUsage
  • QuotaPeakNonPagedPoolUsage
  • QuotaPeakPagedPoolUsage
  • ReadOperationCount
  • ReadTransferCount
  • SessionId
  • Status
  • TerminationDate
  • ThreadCount
  • UserModeTime
  • VirtualSize
  • WindowsVersion
  • WorkingSetSize
  • WriteOperationCount
  • WriteTransferCount
6
  • 2
    NICE!!! I love WMIC. It's what a whole lot of expensive 3rd party stuff is based on. Thanks a ton for taking the time to post both the question and a great complete answer.
    – Jeff Moden
    Commented Sep 25, 2018 at 21:17
  • 1
    Need to run command prompt as Administrator to view CommandLine of all processes. For e.g. CommandLine or ExecutablePath is not displayed for java.exe in non-admin run command prompt.
    – ontherocks
    Commented Dec 10, 2021 at 11:07
  • 2
    And if you want to filter out the "current command" i.e. the wmic command you are running, use: wmic process where "name like '%chrome%' and not Caption='wmic.exe'" get processid,commandline Commented Jan 27, 2022 at 21:19
  • Require "Run as adminsitrator"
    – user436264
    Commented Nov 8, 2023 at 16:51
  • @Vinh it does not require you to launch cmd with "Run as administrator", I just tried. It might however require an account with certain privileges but doesn't require administrator.
    – qwertzguy
    Commented Nov 15, 2023 at 19:08
4

The WMIC tool is deprecated in Windows 10, version 21H1 and the 21H1 semi-annual channel release of Windows Server. This tool is superseded by Windows PowerShell for WMI.

Now we can use PowerShell command to achieve this:

Get-CimInstance Win32_Process -Filter "name LIKE '%OmniSharp.exe%'" | Select ProcessId, CommandLine | format-list

or

Get-CimInstance -Query "SELECT * FROM Win32_Process WHERE name LIKE '%OmniSharp.exe%'" | Select ProcessId, CommandLine | format-table -wrap

0

You can't see the command line in Task Manager. You can however use a third-party task manager program like Process Explorer or Process Hacker to view the command line.

Open the properties dialog of the process in order to view the command line. In the case of Process Hacker, you can even add a column for the command line so that you don't have to open the properties dialogue box.

3
  • 3
    You can see the command line in Task Manager: go to View > Select Columns... and tick the box for Command Line. You can then re-organize the columns by dragging the column headers. However, like my questions says, it is truncated if it is really long, like for java processes with long classpaths
    – qwertzguy
    Commented Nov 22, 2015 at 13:44
  • @qwertzguy: Sorry, I must have missed that. My answer still holds though. You'll have to resort to third-party software in order to achieve your desired result. Commented Nov 22, 2015 at 19:42
  • Actually this was a question that I answered myself. I just posted it to document it for other people. You can see my answer for how to achieve the desired result without the need of third-party software.
    – qwertzguy
    Commented Nov 23, 2015 at 14:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .