如何使用 Laravel 5.1 在 Windows 10 中运行任务调度程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36305146/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 13:29:55  来源:igfitidea点击:

How to run task scheduler in windows 10 with Laravel 5.1

laravelscheduled-tasks

提问by Airmovz

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

我只是想问如何在windows机器(我的本地机器)上使用它的任务调度功能。

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

我已经阅读了它的文档,并且注意到它使用的是 Cron。

Any help is truly appreciated.

任何帮助都非常感谢。

回答by Alexey Mezenin

To run Laravel Scheduler in Windows 10 you need:

要在 Windows 10 中运行 Laravel Scheduler,您需要:

  1. Create batch file, like this one and save it:
  1. 创建批处理文件,像这样一个并保存它:

cd c:\laravel-project\

cd c:\laravel-project\

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

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

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

  2. Click Create basic task, choose When I logontrigger and then choose Start a program-> your .batfile.

  3. Check Open properties dialogoption and click Finish.

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

  1. 转到 Windows 10 任务计划程序(快速方法是按下Win+R并输入taskschd.msc)。

  2. 单击Create basic task,选择When I logon触发器,然后选择Start a program-> 您的.bat文件。

  3. 检查Open properties dialog选项并单击Finish

  4. 在任务属性中单击Triggers,然后单击New并添加新触发器Repeat task every - 1 minute

Now this task will run Laravel scheduler every one minute.

现在这个任务将每分钟运行一次 Laravel 调度程序。

回答by Быстрый лось

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

我还是没有运行schedule,解决办法就是在路径中添加/d

cd c:\laravel-project\

in

cd /d c:\laravel-project\