首页 > 代码库 > php定时执行任务(windows7)

php定时执行任务(windows7)

1:先写自己的php文件,这里是我的一些php文件

2:新建.bat文件

写入内容:E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab1.php

E:\WampSever\wamp\bin\php\php5.4.12\php.exe  这是我的php.exe路径

E:\WampSever\task\Grab1.php  这是我的要定时运行的php文件路径
提示:要是定时执行多个php文件时候只要连起来就可以

E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab1.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab2.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab3.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab4.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab5.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab6.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab7.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab8.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab9.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab10.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab11.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab12.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab13.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab14.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab15.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab16.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab17.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab18.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab19.php
E:\WampSever\wamp\bin\php\php5.4.12\php.exe -q E:\WampSever\task\Grab20.php
3:bat文件建立OK后就可以建立任务计划程序

触发器里面新建设置执行时间

操作里面新建浏览刚才建立的.bat文件

这是我自己计划任务的设置选项:


条件设置根据自己的需求来设置