Skip to content

Instantly share code, notes, and snippets.

@FernandoCelmer
Last active September 21, 2021 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FernandoCelmer/ceb0c8f0450032f7425b22cbd1b24f93 to your computer and use it in GitHub Desktop.
Save FernandoCelmer/ceb0c8f0450032f7425b22cbd1b24f93 to your computer and use it in GitHub Desktop.
Script Python para "matar" alguns processos do windows preenchidos em uma lista.
import time
import os
class KillProcessWin:
def __init__(self, process):
end_time = time.time() + 86400
countTimer = 5
sleepTime = 5
while time.time() < end_time:
time.sleep(sleepTime)
countTimer += sleepTime
for item in process:
# Kill Process
os.system("taskkill /f /im {}.exe".format(item))
# Delete Process
# os.system("wmic process where name='{}.exe' delete".format(item))
if __name__ == "__main__":
process = [
'Process 1',
'Process 2',
'Process 3',
]
KillProcessWin(process)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment