Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

4 Answers

up vote 15 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
2  
That's really cool. –  ekaj Apr 22 '12 at 15:23
    
Unfortunately, it doesn't seem to work with applications protected with WinLicense/Themida: oreans.com/winlicense.php 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
1  
My bad, it didn't run PE elevated. It's working as intended. –  Gepard Apr 22 '12 at 16:46
add comment

go to run or goto start and search:

tasklist -m

tasklist -svc
share|improve this answer
5  
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
add comment

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
add comment

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/sudoserver.py

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]"). 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 server.py
5740 /usr/bin/python2.7 /usr/local/bin/sudoserver.py

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.

share|improve this answer
add comment

Your Answer

 
discard

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.