I recently made the switch from a Linux LAMP server to a Windows Server 2016. It didn’t take me too long to figure out I forgot to transfer my cron jobs for my PHP pages. I went to start the transfer and I soon realized that Windows does not support cron jobs. However, I did find the Windows version of Cron jobs. Below is what I did to create these cron jobs so my PHP crons will continue run on schedule. This trick will really work in all versions of Windows, but you must get to it different methods.
Open the Windows start menu and type in “Scheduled Tasks”. This will open the Task Scheduler. After that click Create Task (I would not suggest using basic task, as it is too basic for cron jobs).
This will open a window that allows you to create a new “Cron Job” in Windows Server 2016 or Windows 10.
Name: This is an easy way for you to remember what that task does. You can enter anything.
Description: Just a more in-depth description for you to remember what it is.
User Account: I would suggest using a full privileged account so that your cron jobs can create and modify files if it needs to. But I would also suggest using an account dedicated to Cron jobs so that you can revoke permissions any time you need to!
Due to the nature of a website, I would definitely check “Run when user is logged in or not” and leave do not store password (This can throw an XML invalid error if you leave this unchecked and a password is required)
And I would also check “Run with Highest Privileges”
After that, Click “Trigger” and “Add new”:
To run a “Cron Job” task that runs more than once a day, Click Daily task. Recure daily, and repeat the task every (How often you want the task to run. You can type in other options in this field than what is given) and be sure to click enabled. After that click Okay and click the tab “Actions” and New…
Set program/Script to the PHP.exe (default is seen in picture) and arguments as the PHP file you want to run. Be sure to use “” if you have spaces in the path. I would suggest using them either way as a rule of thumb.
Now you can create “Cron Jobs” in Windows! Comment if you have any questions or suggestions!