Run php files usign Cronjobs on localhost using task schduler ||PhP
set script.bat paths..
set script path in shellscript.vbs
- Open Task Scheduler using run command (taskschd.msc)
- Go to >Action menu>Create Task
- Fill the Name and Description
- Triggers tab, hit New button >schedule and choose Daily
- Advanced settings
- select Repeat task every (time) && Indefinitely.
- Actions tab >select Start a program.
- and give path of your .vbs file
ShellScript.vbs
Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "C:\xampp\htdocs\cronJob\script.bat" & Chr(34), 0
Set WinScriptHost = Nothing
Script.bat
"C:\xampp\php\php.exe" -f "C:\xampp\htdocs\cronJob\index.php"
index.php
<?php
file_put_contents('./rizi',date('h:i:s')."\n",FILE_APPEND);
?>