Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Randy_Johnson's avatar

Create .bat to run php artisan serve

Hi, is what I am asking possible. I tried this.

@ECHO OFF
cd C:\Users\Josh\Desktop\Files\websites\T-Tobacco
php artisan serve
PAUSE
0 likes
2 replies
guybrush_threepwood's avatar

It's possible, your batch file should be working as long as:

  1. The path provided to the cd command is valid ("C:\Users\Josh\Desktop\Files\websites\T-Tobacco")
  2. You have set up the laravel project in the folder provided ("T-Tobacco"), which includes running composer install
  3. PHP is installed and added to your windows Path variable

What problem are you having? (you can temporarily remove the @echo off line so you have better output for troubleshooting purposes).

PS: The pause command shouldn't be required since the window will remain open until you stop the server with Control+C.

Please or to participate in this conversation.