pyinstaller打包生成的exe文件并使用python终止后台的exe程序运行
目录
pyinstaller打包生成的exe文件并使用python终止后台的exe程序运行
#pyinstaller打包生成的exe文件
#杀死指定的exe程序
#test.bat文件内容
#pyinstaller打包生成的exe文件
#执行打包的过程
pyinstaller --clean --onefile test.py
#生成的文件;
"D:\\test.exe"
双击exe会生成cmd的窗口
#杀死指定的exe程序
import osos.system("taskkill /f /im test.exe")#test.batos.system("taskkill /f /im test.bat")
#test.bat文件内容
@echo off cd d:\teststart test.exeexit
参考:R
参考:Is it possible to kill a process on Windows from within Python?