On this page
- 1 How to Run Laravel Scheduler Automatically on Windows (Herd or XAMPP)
- 1.1 Step 1: Locate Your PHP Executable
- 1.2 Step 2: Open Windows Task Scheduler
- 1.3 Step 3: Set the Trigger
- 1.4 Step 4: Set the Action
- 1.5 Step 5: Enable Privileges
- 1.6 Step 6: Test the Task Manually
- 1.7 Troubleshooting: What If You See 0x1 ?
- 1.8 Final Tip: Check Laravel Logs
- 1.9 You’re Done!
- 1.10 Leave A Comment Cancel reply
How to Run Laravel Scheduler Automatically on Windows (Herd or XAMPP)
Laravel’s task scheduler allows you to automate repetitive jobs like clearing logs, sending emails, and updating data. On Linux, this is handled via cron, but on Windows, we can replicate this behavior using Task Scheduler.
This guide shows you how to configure Laravel’s scheduler on Windows using either Herd or XAMPP as your PHP environment.
On this page
Step 1: Locate Your PHP Executable
You need the full path to the PHP executable used by your Laravel environment. Here’s how to find it:
Option A: Using Herd
Herd installs PHP here by default:
C:\Users\YourUsername\AppData\Local\Programs\Herd\php\php.exe
You can confirm this path from the Herd app → Settings → PHP → Reveal in File Explorer.
Option B: Using XAMPP
If you’re using XAMPP, PHP is typically located at:
C:\xampp\php\php.exe
Universal Tip:
Open Command Prompt and run:
where php
This will return the path Windows uses when calling
php
from the terminal. Use that in the next step.
Step 2: Open Windows Task Scheduler
- Press Windows + S and search for Task Scheduler
- Click Create Basic Task…
- Name it something like Laravel Scheduler
Step 3: Set the Trigger
- Choose Daily and set any time (e.g., 12:00 AM)
- Once created, right-click the task and click Properties
- Go to the Triggers tab and click Edit
- Check:
- Repeat task every: 1 minute
- For a duration of: 1 day
Step 4: Set the Action
Under the Actions tab:
- Program/script: Enter the full path to your PHP executable
- Add arguments:
artisan schedule:run >> schedule.log 2>&1
- Start in: Enter the full path to your Laravel project directory
Example for Herd:
- Program/script:
C:\Users\YourUsername\AppData\Local\Programs\Herd\php\php.exe
- Start in:
C:\Users\YourUsername\Sites\your-laravel-app
Example for XAMPP:
- Program/script:
C:\xampp\php\php.exe
- Start in:
C:\xampp\htdocs\your-laravel-app
Step 5: Enable Privileges
In the General tab of your task:
- Check “Run whether user is logged on or not”
- Check “Run with highest privileges”
Step 6: Test the Task Manually
Open Command Prompt and try the command manually:
cd C:\Path\To\Your\Laravel\Project C:\Full\Path\To\php.exe artisan schedule:run
If it runs without errors, the Task Scheduler setup should work too.
Troubleshooting: What If You See 0x1 ?
The Last Run Result: 0x1 means something is misconfigured. Most likely causes:
- “Start in” field is missing or incorrect
- PHP path is wrong
- artisan command is not found due to wrong working directory
Final Tip: Check Laravel Logs
You can confirm that tasks are running by logging something in your
App\Console\Kernel.php
:
protected function schedule(Schedule $schedule) { $schedule->call(function () { \Log::info('Laravel scheduler ran!'); })->everyMinute(); }
Check
storage/logs/laravel.log
to verify it worked.
You’re Done!
With this setup, Laravel will now run scheduled tasks every minute just like a Linux cron job — but right on your Windows machine using Herd or XAMPP.
