OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to concurrently run three python scripts from a batch file

  • Thread starter Thread starter aardbark
  • Start date Start date
A

aardbark

Guest
Trying to call three python scripts to be run concurrently, in background, with separate stdout file and stderr file for each script. Here is the code used

Code:
@echo off

REM Ensure the logs directory exists (create it if not)
if not exist logs mkdir logs

REM Launch a.py with separate stdout and stderr logs
start /B cmd /c "python .\a.py > logs\a.log 2> logs\a_stderr.log"

REM Launch b.py with separate stdout and stderr logs
start /B cmd /c "python .\b.py > logs\b.log 2> logs\b_stderr.log"

REM Launch a.py with separate stdout and stderr logs
start /B cmd /c "python .\c.py > logs\c.log 2> logs\c_stderr.log"

Running this scripts has only the first script actively running, the rest doesn't run or do anything. There is no conflict or connection between the scripts or any common resource being used in all three. When I run them individually in cmd prompt they work just fine. I want the three scripts to be run in background, concurrently and without any output window. All this is in windows 11
<p>Trying to call three python scripts to be run concurrently, in background, with separate stdout file and stderr file for each script. Here is the code used</p>
<pre><code>@echo off

REM Ensure the logs directory exists (create it if not)
if not exist logs mkdir logs

REM Launch a.py with separate stdout and stderr logs
start /B cmd /c "python .\a.py > logs\a.log 2> logs\a_stderr.log"

REM Launch b.py with separate stdout and stderr logs
start /B cmd /c "python .\b.py > logs\b.log 2> logs\b_stderr.log"

REM Launch a.py with separate stdout and stderr logs
start /B cmd /c "python .\c.py > logs\c.log 2> logs\c_stderr.log"
</code></pre>
<p>Running this scripts has only the first script actively running, the rest doesn't run or do anything. There is no conflict or connection between the scripts or any common resource being used in all three. When I run them individually in cmd prompt they work just fine.
I want the three scripts to be run in background, concurrently and without any output window.
All this is in windows 11</p>
 

Latest posts

Top