Michael Duffett
Michael Duffett

Reputation: 5

Python - Open .bat file in new window and also interact with it

I am trying to run a .bat file in a new window so the user of the PC can input commands, however I want to also be able to programatically input commands at the same time. Is this possible? I have been fiddling around with subprocess and Popen however I havn't been able to get anything to work.

Thanks in advance for any advice.

Upvotes: 0

Views: 792

Answers (1)

mibognar
mibognar

Reputation: 74

If I get your question right, you are looking for something like this:

subprocess.Popen("start your_file_name.bat", shell=True)

It opens a new cmd window and runs your .bat file in it while the python code runs forward.

Upvotes: 1

Related Questions