简体   繁体   中英

how to run php script from batch file

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????

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 %*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM