Task Manager Process Location

Cyril Horad picture Cyril Horad · Apr 29, 2011 · Viewed 13.8k times · Source

Is there a command line syntax in which returns the Image Path / Location of the *.exe on the task manager?

I'm using Windows XP Professional Service Pack 3, I'm aware of the tslist(tasklist) command, but I only get all running *.exe files.

Answer

Lizz picture Lizz · Oct 12, 2012

There is no way from XP's Task Manager to get this info (Vista on up, however, can show this info). Other apps, like MS/SysInternals' "Process Explorer" GUI can show you the full path of all exe's.

Alternatively, a built-in process called WMIC, which uses WMI, can give you this info as in Ramesh's answer:

WMIC PROCESS get Caption,Commandline,Processid

Or, to output to a file and not the command prompt window:

WMIC /OUTPUT:C:\ProcessList.txt PROCESS get Caption,Commandline,Processid

Note: the command prompt will need to have admin rights to launch WMIC.

The commands above will show you output like the following, which includes the PID, process name, full path, and switches passed to the command:

Caption                   CommandLine
                                                    ProcessId
System Idle Process
                                                    0
helpctr.exe               "C:\WINDOWS\pchealth\helpctr\binaries\helpctr.exe" -mode hcp://system/sysinfo/msinfo.xml
                                                    4852
helpsvc.exe               "C:\WINDOWS\PCHealth\HelpCtr\Binaries\HelpSvc.exe" /Embedding
                                                    1908
cmd.exe                   "C:\WINDOWS\system32\cmd.exe"
                                                    4308
cmd.exe                   "C:\WINDOWS\System32\cmd.exe"  /k cd c:\ && color 71 & & title Admin Command Prompt - %username%