I want to get the list of processes in memory including the name and the PID in Windows 8.1.
Here's my code:
import subprocess
import os
cmd = "WMIC PROCESS get Caption,ProcessId"
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
for line in proc.stdout:
# Additional logic here
The loop never runs. This code worked in an earlier version of Windows 8. Is there a different approach someone can recommend?