In my python script:
p = Popen('a.bat')
The problem is that the output of the batch file is placed in the main console window in which I executed my python script ... I want the output of the batch file to appear in a new console window. Any help would be greatly appreciated. Thanks.
You can set the flag CREATE_NEW_CONSOLE . For instance:
CREATE_NEW_CONSOLE
import subprocess p = subprocess.Popen('a.bat', creationflags=subprocess.CREATE_NEW_CONSOLE)
Documents regarding shell=True do not match the implementation . If you specify shell=True , it sets CREATE_NEW_CONSOLE only if the platform is either Win9x or uses the 16-bit COMMAND.COM shell.
shell=True
COMMAND.COM
I haven't used python before, so I can't verify, but this should work
p = Popen('cmd.exe /k start a.bat')