Wednesday, November 5, 2014

Run Cron Jobs on Windows


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.

6 comments:

  1. Just saying thanks will not just be sufficient, for the fantasti c lucidity in your writing. I will instantly grab your rss feed to stay informed of any updates. windows 10 bsod

    ReplyDelete
  2. This is also a very good post which I really enjoyed reading. It is not every day that I have the possibility to see something like this..
    Jobs

    ReplyDelete
  3. I adore your websites way of raising the awareness on your readers.packwoods la dispensary

    ReplyDelete
  4. I am looking for and I love to post a comment that "The content of your post is awesome" Great work!
    먹튀토토사이트

    ReplyDelete
  5. Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for.
    solar power

    ReplyDelete
  6. Really appreciate this wonderful post that you have provided for us.Great site and a great topic as well i really get amazed to read this. Its really good. need job fast

    ReplyDelete

Social Networks Sharing