我有下面的代碼片段,我試圖修改,以在PHP中創建一個計劃任務在窗口中。我嘗試了exec,然後pclose(popen($ cmd))沒有成功。 PHP腳本執行但沒有命令被調用,我看不到我的任務計劃程序gui中添加了計劃任務。PHP/Windows任務計劃程序 - 如何從PHP創建新的任務?
問題
我怎樣才能調用SchTasks.exe會從PHP創建一個新的任務?
代碼段
$daysList = join(", ", $days);
$cmd = "c:\\windows\\system32\\schtasks.exe /CREATE /SC WEEKLY /D \"$daysList\" /TN \"Action Item Reminder\" /TR \"php.exe C:\\wamp\\www\\aim\\module\\Application\\src\\Application\\Controller\\sendmail.php\" /ST 00:01 /f";
pclose(popen("start /B ". $cmd, "r"));
//echo "c:\\windows\\system32\\schtasks.exe /CREATE /SC WEEKLY /D \"$daysList\" /TN \"Action Item Reminder\" /TR \"C:\\wamp\\bin\\php\\php5.5.12\\php.exe C:\\wamp\\www\\aim\\module\\Application\\src\\Application\\Controller\\sendmail.php\" /ST 00:01 /f";
//echo '/CREATE /SC WEEKLY /D "'. $daysList .'" /TN "Action Item Reminder" /TR "C:\wamp\www\aim\module\Application\src\Application\Controller\sendmail.php" /ST 00:01 /f"'; die();
if (isset ($activate))
{
$emailOptionTable->update('true', 'Activate Reminders');
$cmd = "c:\\windows\\system32\\schtasks.exe /Change /TN \"Action Item Reminder\" /Enable";
pclose(popen("start /B ". $cmd, "r"));
}
else
{
$emailOptionTable->update('false', 'Activate Reminders');
$cmd = "c:\\windows\\system32\\schtasks.exe /Change /TN \"Action Item Reminder\" /Disable";
pclose(popen("start /B ". $cmd, "r"));
}
EDIT
本地化問題
Apache的錯誤日誌顯示此信息
012的ERROR: No mapping between account names and security IDs was done.
(46,4):UserId:ERROR: No mapping between account names and security IDs was done.
(46,4):UserId:
我需要做些什麼來解決這個問題?
謝謝你的回覆! – Vahe