Let’s check how we can run a php script through windows task scheduler. The options and path may vary as per the versions of windows. Here, I am referring to Windows 7 Professional.
1.Go to Start > All Programs > Accessories > System Tools > Task Scheduler.
2.Click on Task Scheduler Library. Now Create Task using action menu.
3.Set the Task Name in General Tab. Create a new Trigger and Action using the corresponding tabs.
4.In Actions tab, select “Start a program” from the dropdown list. And as Program/Script, refer to a batch file (Let’s say file.bat) which again refers to the php script to be executed.
In the batch file specify the following line.
php < Absolute path of the php script file present in the virtual directory>
5.Now, Right click on My Computer > Properties > Advanced System Settings > Advanced > Environment Variables > System Variables > Path > Edit > Add the Folder Path of php.exe. Let it be C:\xampp\php > OK