Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
318 views
in Technique[技术] by (71.8m points)

python - List running processes on 64-bit Windows

I amm writing a little python script that will grab information from VMs of Windows that I am running.

At the moment I can list the processes on a 32bit XP machine with the following method:

http://code.activestate.com/recipes/305279/

Is it possible to somehow detect the version of windows running and excute a different method for getting the processes on a 64bit machine, I am trying to get the processes from a 64Bit Vista and 64bit Windows 7.

Any ideas?

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you don't want to rely on any extra installed modules then you can parse the output of wmic, e.g.:

c:> wmic process get description,executablepath    
...
explorer.exe               C:Windowsexplorer.exe
cmd.exe                    C:WindowsSysWOW64cmd.exe
conhost.exe                C:Windowssystem32conhost.exe
...

Reference: http://geekpedia.wordpress.com/2008/08/18/use-command-line-to-track-windows-processes/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...