fbpx

When you are a Laravel Developer you usually work deal with Linux server and that’s cool because it works seamlessly with it. But programmer life is a rollercoaster isn’t it ? Anyways I am not here to going to discuss cons and pros of being developer really ?, since i love being developer, but I just encountered with one problem lately, I had to set Task scheduling in Windows. Dang.

We all have used Cron Jobs and they are fun but for windows it was not that straight forward but finally with few hours in google and I was able to connect dots.

So thought to make a easier tutorial for geeks who going to face this issue.

So lets start.

1. Go to My Computer and click Right. Then You Go to Manage Option.

How to add Laravel Task Schedule on Windows 1

2. After that you show “Task scheduler “option. Click Task Scheduler Option.

How to add Laravel Task Schedule on Windows 2

3. and then Click “Create Task…” option

How to add Laravel Task Schedule on Windows 3

4. And Create a new Task Create a new task by right-clicking on Task Scheduler. Give it a name. Select Run only when the user is logged on and check Hidden.

How to add Laravel Task Schedule on Windows 4

After Create a new Trigger for your Task.

Switch to Trigger tab and click on new to create a trigger for your task. Select Daily and set enter 365 in Recur every day’s input field.

Now move to advance settings and check Repeat task every option and choose 5 minutes from the drop-down. After doing that edit 5 minutes text to 1 minute. So it will run every 1 minutes now.

Choose Indefinitely for the duration and check enabled to run it Indefinitely.

Click OK to move on to next step.

How to add Laravel Task Schedule on Windows 5

And Then Create Actions for your Task.

Switch to Actions tab and click on new to create actions for your task.

In Program/script input enter your PHP installation path, like I do have my XAMPP installed D:\ drive. So the path is D:\xampp\php\php.exe

And Add arguments(optional): in Enter the path to your projects like D:\xampp\htdocs\MYPROJECT

And then Add After The path artisan schedule:run.

So it would look like D:\xampp\htdocs\MYPROJECT\artisan schedule:run.

How to add Laravel Task Schedule on Windows 6

If every step went smoothly, then you have successfully created a task that triggers every minute.

To check if your task is running, find your task in Task scheduler library list and validate last run time.

That’s it.