The Computer Oracle

How do I find out command line arguments of a running program?

Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping

--

Chapters
00:00 Question
00:27 Accepted answer (Score 94)
00:51 Answer 2 (Score 122)
01:18 Answer 3 (Score 64)
02:23 Answer 4 (Score 11)
03:06 Thank you

--

Full question
https://superuser.com/questions/415360/h...

Accepted answer links:
[Process Explorer]: https://docs.microsoft.com/en-us/sysinte...

Answer 4 links:
[i kill zombies with powershell]: http://dave.thehorners.com/tech-talk/win...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows7 #windows #commandlinearguments

#avk47



ANSWER 1

Score 128


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



ACCEPTED ANSWER

Score 100


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:
List of "chrome.exe" processes

Alternatively, you can open the properties of the process and inspect the command line right there:
Properties of a "chrome.exe" process




ANSWER 3

Score 68


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.




ANSWER 4

Score 12


PowerShell to the rescue.

Find:

Get-WmiObject Win32_Process -Filter "name = 'perl.exe'" | where {$_.CommandLine -eq '"C:\strawberry\perl\bin\perl.exe" t/Server_PreFork.t'}

And kill as bonus:

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 }

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...