Wednesday, March 19, 2014

Write windows .bat file to execute a PHP file

    1. Open a notepad and write the following command

    Path to your php.exe file -f "path to your php script where you want to execute "

    E.g.:
    C:\wamp\bin\php\php5.3.13\php.exe -f "C:\wamp\www\TestFramework\src\controllers\Email.php"

    1. Save the file with any with .bat extension.



    1. You can directly run this .bat file also. In windows 7 make sure to run it under Administration privileges. But it is not nice to run the batch file manually all the time. So we can use Windows task scheduler to do this. 

No comments:

Post a Comment