Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Obtain the command line from a running process from the Command Prompt [closed]

I wanted to determine the command-line arguments of a running process at the Command Prompt (cmd.exe).

E.g., if I started my abc.exe program as follows:

abc -d 

I want to determine the whole command line later. The TASKLIST utility does not provide this info, because it just reports the exe name and not the arguments with which the process was started.

like image 398
Deepak Avatar asked Oct 21 '25 10:10

Deepak


1 Answers

Here is a GUI-based method (Tested on Windows 7 - YMMV). I don't know of an easy method to get this data from the command-line.

  1. Open the Task Manager (CTRL+SHIFT+ESC), and go to the Processes tab.
  2. From the View menu -> Select Columns...
  3. Scroll to the very bottom and select "Command Line"
  4. In the newly-shown "Command Line" column, you can see the entire command that started the process, including any command-line parameters

Command-line method:

  1. Start a PowerShell with administrator priviledges
  2. Use the Get-WmiObject to list processes and filter the process name above. Add/remove fields through the select statement below - example:

    Get-WmiObject win32_process -Filter "name like '%notepad.exe'"|select CreationDate,ProcessId,CommandLine|ft -AutoSize
    

Note: The process name "notepad.exe" is used for this example, substitute the name for your specific scenario.

like image 76
mellamokb Avatar answered Oct 24 '25 03:10

mellamokb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!