how to run php script from batch file

十年热恋 提交于 2019-12-08 13:58:06

问题


I have used this article php script which named upload_.php and i have successfully developed a windows service in C# which is running fine. Now in theory the service will run every hour and execute a batch file (task.bat). if i run the upload_php file directly it works fine now i think the problem is in task.bat file. here is my code

Task.bat Code

@echo off
cd\
set path=C:\xampp\php;
cd "C:\xampp\htdocs"
php import.php
exit

When service runs it execute task.bat file but php script dont execute. what is wrong with my code????


回答1:


this worked for me although im not a php developer a colleague helped me

@echo OFF
"D:\xampp\php\php.exe" D:\xampp\htdocs\upload_.php %*


来源:https://stackoverflow.com/questions/14750523/how-to-run-php-script-from-batch-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!