Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to display a process's command line (including any arguments) from the command line itself. In other words, I want to show the "Command Line" column in the Task Manager but from a command line. Is this possible?

For example, the output might look something like

C:\java\bin\java.exe -Dhttp.proxyHost=http://localproxy -Dport=8331
share|improve this question
up vote 4 down vote accepted

You can use Microsoft's official Process Explorer. It can do exactly this and has many many more useful features.

share|improve this answer

Wmic.exe will show you what you are looking for:

wmic path win32_process get name, commandline > commandline.txt

Java looks like:

"C:\Program Files\Java\jre6\bin\jqs.exe" -service -config "C:\Program Files\Java\jre6\lib\deploy\jqs\jqs.conf"

For all available attributes, try:

wmic path win32_process get /format:list
share|improve this answer
I am getting error "Invalid GET expression" for the comma put between name and commandline. Rest all is working like charm. – Krishna Pandey Jan 7 at 19:57
I'm guessing you're running this within a batch file? try escaping the comma like so: "wmic path win32_process get name^, commandline" – RobW Jan 8 at 0:16
I was running it from powershell, will try this and update. – Krishna Pandey Jan 8 at 5:19
Ok - If you issue the 'all available attributes command' noted above, in powershell, you get expected results. On reading further, in power shell, the comma does indeed need to be escaped. However, you use the forward quote: ` to do so: wmic path win32_process get name`, commandline – RobW Jan 18 at 18:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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