Last active
September 21, 2021 04:07
-
-
Save FernandoCelmer/ceb0c8f0450032f7425b22cbd1b24f93 to your computer and use it in GitHub Desktop.
Script Python para "matar" alguns processos do windows preenchidos em uma lista.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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