Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Laravel Scheduler on Windows

Run Laravel Scheduled Tasks on Windows

The following are instructions for running scheduled tasks defined in a Laravel project on Windows. The Laravel documentation provides instructions for running scheduled tasks using cron jobs on Linux systems. However, cron jobs are not available on Windows. The built-in Windows Task Scheduler can be used to run scheduled tasks instead.

Create a Scheduled Task

  1. Open Task Scheduler
  2. Select Create Task...
  3. Give the task a name and description
  4. To run the task in the background, select Run whether the user is logged on or not and check the Hidden checkbox.

Triggers

  1. Create a new trigger.
  2. Set the trigger to run Daily and recur every 1 days.
  3. Set Repeat task every to 1 minutes. 1 minutes is not a selectable option. Simply select 5 minutes from the dropdown and then manually edit.
  4. Set for a duration of: to Indefinitely.
  5. Ensure that Enabled is checked.

Actions

  1. Create a new action.
  2. Start php by entering the php binary location, such as C:\php\php.exe
  3. Set Add arguments field to C:\{project-dir}\artisan schedule:run (replace {project-dir} with appropriate path).

Settings

  1. Check Allow task to be run on demand.
  2. Check Run task as soon as possible after a scheduled start is missed.

Wrap-up

  1. To ensure that the task is running, find the task in the Task Scheduler Library.
  2. Note the task Status. It may be Ready or Running.
  3. Note the Next Run Time and Last Run Time properties.
@gerymeli
Copy link

gerymeli commented Dec 14, 2020

Great ! This article helped me !

@iwandepe
Copy link

iwandepe commented Jul 26, 2021

Big help ! Thank you!

@alabienG
Copy link

alabienG commented Aug 9, 2021

merci beaucoup pour cet article, très utile

@CymonPK
Copy link

CymonPK commented Dec 1, 2021

Thank you so much. This saved me a number of hours

@Emmanuelamanga
Copy link

Emmanuelamanga commented Mar 9, 2022

Saved my day. Thanks a great deal.

@jaducana1995
Copy link

jaducana1995 commented Jun 27, 2022

Why not triggering in console log?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment