Super User is a question and answer site for computer enthusiasts and power users. 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'm looking for a tool or method to find out what command line parameters have been passed to a program, for example when it was run by another program (launcher-application scenario).

share|improve this question
up vote 34 down vote accepted

You can do that using Process Explorer.

Just hover with your mouse over a process to see the command line arguments used to start it:
enter image description here

Alternatively, you can open the properties of the process and inspect the command line right there:
enter image description here

share|improve this answer
That's really cool. – cutrightjm Apr 22 '12 at 15:23
Unfortunately, it doesn't seem to work with applications protected with WinLicense/Themida: Any other ideas? – Gepard Apr 22 '12 at 16:24
@Gepard: How do you know it doesn't work? Are you sure the application was, in fact, called with command line arguments? Either way, PE uses the Windows way of determining that information. Anything else would have to be custom-tailored to a specific application, I assume. – Oliver Salzburg Apr 22 '12 at 16:37
My bad, it didn't run PE elevated. It's working as intended. – Gepard Apr 22 '12 at 16:46
@OliverSalzburg, How did this program work? Can any normal C program achieve this? – Pacerier Jan 20 '15 at 3:17

You can do it without Process Explorer, too, using Windows' WMI service. Run the following from the command prompt:

WMIC path win32_process get Caption,Processid,Commandline

If you want to dump the output to a file (makes it a bit easier to read), use the /OUTPUT switch:

WMIC /OUTPUT:C:\Process.txt path win32_process get Caption,Processid,Commandline
share|improve this answer
Nice, how did you know this? – Pacerier Jan 20 '15 at 3:18
@Pacerier: I'm not sure to be honest ;-) I think it came from digging around the WMI docs and playing around because I needed to use WMI for something at the time. – Andy E Jan 20 '15 at 9:06
Which WMI docs are you referring to? – Pacerier Jan 22 '15 at 3:48
These ones. – Andy E Dec 7 '15 at 12:13
This was a very helpful command line method for getting the command line of a running process. In my case, I was able to tweak this slightly to get output just for a specific process: WMIC path win32_process where "caption='cmd.exe'" get Commandline – chriv Mar 30 at 17:32

One can also achieve that by using Task Manager.

Open task manager (by CTRL-SHIFT-ESC, CTRL-ALT-DELETE or any other method).

For Windows 7 (and probably Windows XP):

  • Go to "Processes" tab. The on the "View" menu, select "Select Columns...".
  • Check the checkbox of "Command Line" and click OK. (You may have to scroll down to find it)

For Windows 8:

  • Go to "Details" tab. Right-click on any of the columns (eg. Names, PID etc.) and select "Select columns".
  • Check the checkbox of "Command Line" and click OK. (You may have to scroll down to find it)

A column of Command lines of will be added to the currently displayed columns.

share|improve this answer
This only shows what will fit in the visible window area, so it's not helpful for long commands. – Jesse Barnum Nov 9 '15 at 19:47
I don't really get you @JesseBarnum, one can always resize the column to have a complete view no matter how long the command line is, right? – Jeromy Adofo Dec 7 '15 at 0:35
Only if the window is wide enough for the size of the command. If the command is something like a Java process with a long classpath, that won't fit in the window width. – Jesse Barnum Dec 7 '15 at 16:03
Alright thanks, noted. I haven't had that problem though and by the way my task manager is scrollable - don't know about yours :-). I think if you can send me a sample program to try, that could settle it. – Jeromy Adofo Dec 18 '15 at 16:57

powershell to the rescue.

Get-WmiObject Win32_Process -Filter "name = 'perl.exe'" | where {$_.CommandLine -eq '"C:\strawberry\perl\bin\perl.exe" t/Server_PreFork.t'} | ForEach-Object { Invoke-WmiMethod -Path $_.__Path –Name Terminate }

find, and kill as bonus. you can run it from powershell directly or from a ps1 if you've got your system setup. I detail unrestricted script setup on i kill zombies with powershell as well as other powershell tricks...

share|improve this answer

When using CygWin, if I start a Python process, this is an example of command line:

c:\CygWin\bin\python2.7.exe /usr/local/bin/

But Process Explorer only sees the main exe:

Process Explorer not detecting full command line of Python process

(note the "path: [Error opening process message]" (see EDIT-1)). Same results for tasklist:

C:\>tasklist | find "python" /i
python2.7.exe                 5740 Console                    1    15.312 KB

So, the only trick I know until now, is finding it via CygWin Bash shell pgrep:

Luis@Kenobi /cygdrive/c/
$ pgrep -f -l
5740 /usr/bin/python2.7 /usr/local/bin/

It is useful to know this, as long as CygWin cohabits with no problems in Windows, and you can use it to run many POSIX and Python programs.

EDIT: In Windows you don't seem to need administrator priviledges for tasklist. In CygWin you will need them to be able to view an administrator's process (what seems more logical to me: the full command-line could have some parameters like passwords inside), so we must run the CygWin Bash in elevated Administrator Mode.

EDIT-1: This problem will not happen if you run Process Explorer as administrator. Thanks you for pointing, @Pacerier.

share|improve this answer
If you run as administrator you wouldn't be seeing [Error opening process message] – Pacerier Jan 20 '15 at 3:20
You were right, @Pacerier . Too obvious to remember :-) . Thanks you. I have edited my post to reflect it. – Sopalajo de Arrierez Jan 20 '15 at 3:30

go to run or goto start and search:

tasklist -m

tasklist -svc
share|improve this answer
That does not show the calling command line. /m shows loaded modules (DLLs, etc.) and /svc shows services hosted in each process. – Bob Nov 2 '12 at 5:02

You must log in to answer this question.

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