test.bat @echo off for /L %%i in (40, -1, 10) do ( echo working %%i test1 ping localhost -n 2 > nul ) echo Done! main.py import subprocess startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW startupinfo.wShowWindow = 5 process1 = subprocess.Popen('test.bat', stdout=subprocess.PIPE, text=True, creationflags=subprocess.CREATE_NEW_CONSOLE) while process1.poll() is None: test1 = process1.stdout.readline() print(test1.rstrip(), flush=True) What is the point of creationflags=subprocess.CREATE_NEW_CONSOLE ... if the console window has nothing inside it ... because the output is being redirected with stdout=subprocess.PIPE? Is there a way subprocess.popen opens the actual bat file (with output visible in the console window) ... and forks off the stdout=subprocess.PIPE into a variable ... at the same time? (without saving stdout=subprocess.PIPE into a text file) Continue reading...