Python implmenentation of finding process's command line parameters.

Giampaolo Rodola' gnewsg at gmail.com
Fri Jul 3 15:33:48 EDT 2009


On 3 Lug, 21:15, Tim Golden <m... at timgolden.me.uk> wrote:
> dudeja.ra... at gmail.com wrote:
> > I'm looking for some python implementation of finding the command line
> > parameters of a process on Windows XP SP3 machine. I found some links but
> > they all point me to the direction of c/c++ implememtations.
>
> > I've seen WMI, but this takes time to load. So I just though if some one has
> > done implementation and could pointing me in some right direction.
>
> Someone recently posted an example using PSI [1] which seemed
> quite fast.
>
> TJG
>
> [1]http://www.psychofx.com/psi/trac/wiki/

If I'm not mistaken psi shouldn't support Windows.
You can use psutil:
http://code.google.com/p/psutil/

 >>> import psutil
 >>> p = psutil.Process(7055)
 >>> p.cmdline
 ['/usr/bin/python', '-O']
 >>>

--- Giampaolo
http://code.google.com/p/pyftpdlib
http://code.google.com/p/psutil/



More information about the Python-list mailing list