Cron job in windows XAMPP

 With the XAMPP version greater than 3.0.0, We can easily achieve the cron job by adding a .bat processing file in the windows operating system.

Prerequisites

  • Windows 
  • XAMPP
  • Authentication to run create & delete bat files

What is cron job?
    Cron job is a task scheduler, you might have heard this name if you have been in a linux servers or any Cpanel activities before.  Yes, actually cron jobs are for linux based platforms & in windows they are called as Schedulers.

In this case we are going to create 2 .bat files to create & delete a scheduler.

1. Create Scheduler:
  • Create start_scheduler.bat  file in your machine.
  • Paste the below code inside that.
    @echo off
    schtasks /Create /TN XAMPP /TR "C:/xampp/php/php-win.exe C:/xampp/htdocs/cron/index.php" /SC MINUTE /MO 1
    pause

  • In my case i'm planning to run a index.php file every one minute.

2. Delete Scheduler

  • Create delete_scheduler.bat  file in your machine.
  • Paste the below code inside that.
    @echo off
    schtasks /Delete /TN XAMPP /F
    pause

You can also open a file using browser by using the below command

@echo off
schtasks /Create /TN NameFilling /TR "C:\Program Files\Mozilla Firefox\firefox.exe http://localhost/appgrouplink/grabber/namefiller" /SC MINUTE /MO 1
pause
 

Post a Comment

0 Comments