0

I want to list the process running on Windows XP using a Python program. I would love to have a similar list to the one that the windows task manager shows. I know this is possible with a Unix system, but I am not sure if subprocess Python's module can perform this for a Windows XP operating system ? Mainly, I want retrieving those processes using Python and save them into a text file.

  • what about `tasklist` ? It is a win XP command that works the same way as `ps` in Unix systems – Aserre Jun 04 '14 at 08:19
  • I want to do that with Python instead –  Jun 04 '14 at 08:19
  • 1
    This question might help: http://stackoverflow.com/questions/3429250/determining-running-programs-in-python – routeburn Jun 04 '14 at 08:22
  • Do you want to avoid calls to Windows system functions ? otherwise, calling `subprocess.call("tasklist")` with the right stdout arguments will do the trick – Aserre Jun 04 '14 at 08:24
  • but `subprocess.call("tasklist") ` will launch the task manager, I rather want to list the processes and save them into a file. –  Jun 04 '14 at 08:25
  • 2
    it won't launch task manager. The taskmanager is launched with `taskmgr.exe`. You can do exactly the same thing as in the question suggested by routeburn. The only difference is that in this question, the user calls `WMIC PROCESSES ...` instead of `tasklist`. In the end it all depends ont the output format you want. You will still be able to redirect output to a file – Aserre Jun 04 '14 at 08:28

1 Answers1

0

I think you need Windows Management Instrumentation. It is a Python module that handles lot of tasks, including the one you mentioned.

As the link shows, you may list all the running processes. You can also list the processes that only a given program runs.