我使用Windows7任务计划程序运行PHP脚本每5分钟创建一个文件,但我遇到批处理文件的问题,它不会给我任何错误,但它不会创建文件
start php.exe C:\wamp\www\temp.php
也许我在这里遇到了一个可怕的错误,这就是我需要帮助的原因!我第一次写或使用批处理文件... 如果我直接运行批处理文件(双击它),它会创建文件,以便问题可能在任务计划程序中?!
这是PHP文件
<?php
$filename=date("d-m-y",time());
$myFile = $filename.'.txt';
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = rand(0,100);
$stringData=$stringData."*";
fwrite($fh, $stringData);
//fwrite($fh, "\n");
fclose($fh);
?>
在此先感谢:)
答案 0 :(得分:2)
你能不能像这样运行它?
C:\wamp\bin\php\php5.3.5\php.exe C:\wamp\www\temp.php
答案 1 :(得分:1)
可能是您设置PATH变量的方式不再知道start
命令所在的位置。考虑将该文件路径添加到PATH变量,而不是简单地覆盖PATH变量。