构造两个bat
其中一个a用于启动服务
另一个b用于启动a.bat
a.bat文件
@echo off
call conda activate AiYinMei
python main_not_flask_server.py
b.bat文件
@echo off
powershell.exe -command "& {Start-Process -WindowStyle hidden -FilePath './a.bat'}"
# 查看运行的python服务
tasklist | findstr "进程名"
tasklist | findstr "python"
# 杀除进程
taskkill /F /T /pid 1230