我需要使用 python 脚本启动一个 exe,但我也需要使用相同的脚本来杀死它
一个开始的想法是:
process = magicCommand( 'theExe.exe' ) #invoke exe
kill = 'no'
while kill == 'no':
kill = raw_input()
otherMagicCommand( process ) #kill
编辑
这对我有用
process = subprocess.Popen( 'theExe.exe' ) #invoke exe
kill = 'no'
while kill == 'no':
kill = raw_input()
process.kill() #kill