17

I just want to ask how to use it's task scheduling feature on windows machine (my local machine).

I've read it's documentation and I've notice that it's using a Cron.

Any help is truly appreciated.

ManojKiran A
  • 5,896
  • 4
  • 30
  • 43
Airmovz
  • 179
  • 1
  • 1
  • 3
  • may be it can help you http://stackoverflow.com/questions/7195503/setting-up-a-cron-job-in-windows – Imtiaz Pabel Mar 30 '16 at 09:57
  • after too much research I found proper solution for windows server, see here I shared full details about how to use Laravel scheduler in windows server. https://stackoverflow.com/a/69954322/14344959 – Harsh Patel Nov 13 '21 at 12:53

2 Answers2

43

To run Laravel Scheduler in Windows 10 you need:

  1. Create batch file, like this one and save it:

cd c:\laravel-project\

c:\php5\php.exe artisan schedule:run 1>> NUL 2>&1

  1. Go to Windows 10 Task Scheduler (fast way is press Win+R and enter taskschd.msc).

  2. Click Create basic task, choose When I logon trigger and then choose Start a program -> your .bat file.

  3. Check Open properties dialog option and click Finish.

  4. In task properties click Triggers, then click New and add new trigger Repeat task every - 1 minute.

Now this task will run Laravel scheduler every one minute.

Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279
  • Do I need to put the path of my php.exe or the path of my project? – Airmovz Apr 04 '16 at 05:58
  • If you're askig about step 1, then answer will be - both. Please look at step 1: `cd` command will change current directory to your project's directory. Then you need to use path to your `php.exe` file. – Alexey Mezenin Apr 04 '16 at 06:06
  • 1
    what will be the content of my .bat file? I'm still confuse of the two paths. – Airmovz Apr 04 '16 at 06:57
  • I think step 1 is very clear. I will give you another example though, maybe it will be helpful for you: first line of `.bat` file: `cd c:\myprojects\mylaravelproject\` and second line `c:\php5\php.exe artisan schedule:run 1>> NUL 2>&1` – Alexey Mezenin Apr 04 '16 at 07:18
  • Hi guys, I configure all like in the answer above. If I run my task In the Schedule panel It runs vey well, but doesnt run in the time I specify, can u help me ? I dont know why. Thanks – Marco Feregrino Jan 16 '17 at 22:08
  • 2
    For what it's worth, I had to tackle this today also. I used Alexey's solution with one small change. I am running XAMPP on a Win 10 machine, Laravel 5.3. I created the batch file and task as he outlined but changed the second line of .bat to 'php artisan schedule:run'. Worked like a charm. Also, I placed my .bat in my project root just to keep everything in one spot. Hope this helps anyone else trying to do same. – RushVan Aug 02 '17 at 14:44
  • Thanks. That really helped. – Dewan159 Jan 20 '19 at 19:05
  • create file .bat (example: c:/command.bat) Write in file .bat -> C:\xampp\php\php.exe C:\xampp\htdocs\'NameProject'\artisan schedule:run Go Step 2 – Daniel Candido Sep 05 '19 at 14:50
  • Can you explain this command `c:\php5\php.exe artisan schedule:run 1>> NUL 2>&1` ?. Especially this parameters `1>> NUL 2>&1` – Kuppusamy Sep 13 '19 at 04:13
-1

I still did not run the schedule, the solution was just to add / d to the path in

cd c:\laravel-project\

in

cd /d c:\laravel-project\
potato
  • 11
  • 2