Skip to main content

Cronjob Windows using TaskScheduler

In previous note about cronjob auto open a web page we used a simple batch script to call browser open url.
In this note I implement a simple cronjob using TaskScheduler and batch script call a php.exe command. My project use laravel command console. If it is raw php file we can run by direct execute filename.

A note from other site: https://laracasts.com/discuss/channels/general-discussion/running-schedulerun-on-windows

My cron_crawl_data.bat:

$ cat ~/Desktop/SadHill/cron_download_Data_rx.bat
cd e:\setin\xampp_56\htdocs\XP_Project\MyProject\
E:\setin\xampp_56\php\php.exe artisan cron:crawlData 1>> NUL 2>&1

Task Scheduler:

A mentioned in a note (I too lazy to search history to get link), you may be need open TaskScheduler from Windows start > Accessories > systemtools > ... instead of call from Right click My Computer.

After add task you have to refresh to see newly added task.

I too lazy to test cron run or not. May be using a test like open webpage or write log to determine is the cron work or not.

Notes:
- When cron run open cmd windows. Are the next cron open new or still in this window ?
* In test: next cron do not open new window, it use the same previous cron use. So we do not have to worry about too many window open on Server.

Comments