如何终止 explorer.exe 进程? [英] How can I kill the explorer.exe process?
本文介绍了如何终止 explorer.exe 进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写一个脚本来杀死 explorer.exe.我搜索了一下,我见过的最好的答案是使用 taskkill
命令.我试过了,但是当我在我的电脑上运行它时,它说它有效,但实际上并没有杀死它.
I'm writing a script which is meant to kill explorer.exe. I searched a bit about it and the best answer I've seen uses the taskkill
command. I tried it, but when I run it on my computer it says it worked but it doesn't actually kill it.
import os, socket
s = socket.socket()
host = socket.gethostname()
try:
s.bind((host, 75))
except socket.error:
print 'Error: Premission denied, please run as admin'
exit()
s.listen(5)
while True:
print '[*] Deploying Server on: ' + host
print '[*] Scanning..'
c, addr = s.accept()
print '[*] Connection established from ' + str(addr)
while True:
try:
os.system("taskkill /im explorer.exe")
cmd = raw_input()
if cmd == 'exit':
print '[!] Exiting'
c.send('exit')
s.close()
exit()
c.send(cmd)
except KeyboardInterrupt:
print '[!] Exiting'
c.send('exit')
s.close()
exit()
有效载荷:
import os
import socket
import platform
print 'Starting'
system = platform.system()
windows = ['Microsoft', 'Windows']
s = socket.socket()
host = socket.gethostname()
print host
print platform.system()
try:
s.connect((host, 75))
except socket.error:
s.close()
s.connect((host, 75))
while True:
cmd = s.recv(1024)
if cmd == 'exit':
s.close()
exit()
os.system("taskkill /im explorer.exe")
print(os.system("taskkill /im explorer.exe"))
推荐答案
我遇到了同样的问题,我需要终止 explorer.exe 进程.显然,您必须强行使用 /F
标志终止进程.
I was running into this same issue, where I need to kill the explorer.exe process. Apparently you ahve to forcibly kill the process with a /F
flag.
os.system("taskkill/im explorer.exe/F")
这篇关于如何终止 explorer.exe 进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文