在python中使用单个批处理文件运行两个exe文件 [英] running two exe files with a single batch file in python

查看:284
本文介绍了在python中使用单个批处理文件运行两个exe文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用python中的单个批处理文件运行两个程序.

I wanted to run two programs using a single batch file in python.

下面的代码可以做到这一点,但是我希望当第一个程序完成执行后,第二个程序将停止运行,并且批处理文件将关闭.

The code below does this, but I want that, when the first program has finished executing the second program will stop running and the batch file will close.

@ECHO off
start C:\Users\User1\Desktop\Softwares\Googletalk
start C:\Users\User1\Desktop\Softwares\YahooMessenger

推荐答案

@echo off
setlocal
start "my_yahoo" /D "C:\Users\User1\Desktop\Softwares\" "YahooMessenger"
start /WAIT "my_gtalk" /D "C:\Users\User1\Desktop\Softwares\" "Googletalk"
for /f "tokens=2 delims=," %%i in ('tasklist /nh /fo csv /fi "WINDOWTITLE eq my_yahoo"') do taskkill /PID %%i /F >NUL 2>&1
endlocal
exit/B

这篇关于在python中使用单个批处理文件运行两个exe文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆