批处理 - 多线程工匠服务器

问题描述 投票:0回答:1

问题很简单,如何同时运行两个php artisan命令?

我有两个命令:

php artisan serve --host=0.0.0.0 --port=80php artisan queue:work --queue=high,default

如果我在单独的cmd窗口中运行它们,它可以工作,但我想将它们放在一个cmd窗口中。

这可能吗?我目前有这个代码:

@ECHO OFF
ECHO Starting DigiCoach Application
TITLE Digicoach Console application
ECHO This might take a while...
CMD /T:70 /b php artisan serve --host=0.0.0.0 --port=80
CMD /T:70 /b php artisan queue:work --queue=high,default
php windows laravel batch-file cmd
1个回答
0
投票

如果你启动它们,它们将并行运行:

Start "" php artisan serve --host=0.0.0.0 --port=80
Start "" php artisan queue:work --queue=high,default

编辑。根据@ Aacini的评论,/b开关可能对您需要的内容很有用,因为它可以在不打开新窗口的情况下启动两个命令。

Start /b "" php artisan serve --host=0.0.0.0 --port=80
Start /b "" php artisan queue:work --queue=high,default

但是我不建议这样做,因为输出不会是你所期望的。像调用2 ping命令这样简单的东西可能会产生一个看似未知语言的输出,因为一个命令输出会干扰其他命令。

© www.soinside.com 2019 - 2024. All rights reserved.