38

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

66

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

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
3
  • 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
    Sep 25, 2018 at 21:17
  • 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
    Dec 10, 2021 at 11:07
  • 1
    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 Jan 27 at 21:19
1

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
  • 2
    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
    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. 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
    Nov 23, 2015 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.