command line of a process.exe on another host

Giampaolo Rodola' gnewsg at
Fri Jun 12 06:47:53 EDT 2009

On 12 Giu, 00:18, "Harry" <h... at> wrote:
> HI ,
> I have number of process run on different windows servers which run's with
> different command line parameters. for example "process.exe -input<ddd>
> statusurl:"., These parameters can vary from host to host.
> using Psexec I know the PID and process name which are running on these
> machines, but how I can read the command line parameters of these process.
> Is there a way to read these command line of the proess via python pls?
> any feedback appreciated..
> thanks
> Hari

You can easily do this with psutil [1]:

>>> import psutil, os
>>> p = psutil.Process(os.getpid())
>>> p.cmdline

Since psutil uses the native Windows calls to retrieve such kind of
info it's a lot faster than using any WMI-based solution.


--- Giampaolo

More information about the Python-list mailing list