Cron is name of a tool in Unix based operating systems. Cron is a time based scheduler which helps to run specific command on a specific date and time. Basically it used for automation of a service or software. For instance in a web application,if the developer want to send an email to the users everyday, this action can be automated using Cron jobs. Otherwise somebody need to call (run) the webpage everyday. In Linux server, user simply write a PHP webpage for sending the email and ask Cron to run it everyday on a specific time.
Now the problem with windows is that, you don't have access to Cron. But no worries here in this article we will teach you how to simulate the Cron in Windows environment.
- First, right click on your favorite browser icon, and select properties.
- Second, copy the address in "Target" field.
- Next, open the notepad and paste the address that you copied in middle of pair of double quotation signs.
- Then, add a white space, and write the address of your PHP/ASP page which you want to run on a spspecificchedule in middle of pair of double quotation sign. (example below)
- "C:\Users\User\AppData\Local\Google\Chrome\Application\chrome.exe" "http://localhost/myproject/send_mail.php"
- Now, save the file with your desire name but with ".bat" extension. for instance cron.bat
- Go to "Control Panel" and open "Schedule tasks".
- Click on "Create Basic Task"
- Chose a name for your task (example: "SendMail Cron") and click Next.
- Chose the timing schedule for the calling of the web page. And click Next.
- In "Action" part, chose "Run a program" click next.
- Now select the batch file which you created sooner (ex "cron.bat")
- Finish
Now "Windows task scheduler" will run the batch file ("cron.bat") on that specific date and time which you adjusted. Consequently the batch file call your browser with the address of the web page which should be run.