Reputation: 316
I'm trying to run a php file within a batch file. I have the folder for php.exe within the same directory as the bat.
set addLocation="%cd%\test.php"
set exeLocation="%cd%\php\php.exe"
start "run" "%cd%\php\php.exe" "%location%"
pause
Any help would be appreciated
Upvotes: 0
Views: 2414
Reputation: 11
You can follow the following code:
To change the directory -
set path = D:\Workspace
CD /D %path%
To run the php file -
php file.php
This code will work well. Thank you.
Upvotes: 0
Reputation: 94672
I use this method myself
Batch file called xxxx.cmd
PATH=%PATH%;C:\path\to\folder\with\phpexe
CD \path\to\php_source
php file.php
The php folder is added to the PATH only for the duration of this command windows existance
Upvotes: 4