How to run many PHP scripts in parallel and redirect the output of each script to a file?

Suppose I have a PHP script that takes two parameters from the command line and simply prints them as output.

I need a batch file that runs many of these PHP scripts in parallel with different parameters and redirects the output of each script to another file.

I tried something like

start "" php index.php 1 2 >> tmp1.txt
start "" php index.php 3 4 >> tmp2.txt

It runs them in parallel, and their outputs are printed in the console window. But I want to redirect each output to a file.

What needs to be changed in a batch file to get output index.phpredirected to a file?

+4
source share
1 answer

Microsoft > >> |.

?

start "" php index.php 1 2 >>tmp1.txt

start tmp1.txt, .

?

start, ^, php.exe .

start "" php.exe index.php 1 2 ^>^>tmp1.txt
start "" php.exe index.php 3 4 ^>^>tmp2.txt

, , , php.exe script index.php.

, Aacini, /C, php.exe .

start "" cmd.exe /C php.exe index.php 1 2 ^>^>tmp1.txt
start "" cmd.exe /C php.exe index.php 3 4 ^>^>tmp2.txt

, .

start "" cmd.exe /C ^>^>tmp1.txt php.exe index.php 1 2
start "" cmd.exe /C ^>^>tmp2.txt php.exe index.php 3 4
+2

Source: https://habr.com/ru/post/1621124/


All Articles