PHP code example of patelworld / windows-task-scheduler
1. Go to this page and download the library: Download patelworld/windows-task-scheduler library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
patelworld / windows-task-scheduler example snippets
use PatelWorld\TaskScheduler\Factory\TaskFactory;
use PatelWorld\TaskScheduler\WindowsTaskScheduler;
$factory = new TaskFactory();
$scheduler = new WindowsTaskScheduler();
// Create a daily task that runs at 8:00 AM
$task = $factory->createDailyTask(
'BackupDatabase',
'C:\\scripts\\backup.bat',
'08:00'
);
$scheduler->createTask($task);
$tasks = $scheduler->getAllTasks();
foreach ($tasks as $task) {
echo $task->getName() . "\n";
}
$scheduler->deleteTask('BackupDatabase');