Execute php script in a bat file: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
mNo edit summary
Line 22: Line 22:
Options "-f <file>        Parse and execute <file>."<ref>[http://php.net/manual/en/features.commandline.options.php PHP: Options - Manual]</ref>
Options "-f <file>        Parse and execute <file>."<ref>[http://php.net/manual/en/features.commandline.options.php PHP: Options - Manual]</ref>


== Sample bat file ==
== Example bat file ==
Condition1: The DOS window was NOT closed when PHP script which implemented [http://php.net/manual/en/function.exit.php exit()] and returned error.
Condition1: The DOS window was NOT closed when PHP script which implemented [http://php.net/manual/en/function.exit.php exit()] and returned error.
<pre>
<pre>
Line 41: Line 41:
</pre>
</pre>


instruction:
* [https://www.computerhope.com/echohlp.htm MS-DOS echo command help]
* [https://ss64.com/nt/exit.html Exit - Terminate a script - Windows CMD - SS64.com]
* {{kbd | key=<nowiki>PAUSE</nowiki>}} at the end of file to prevent auto closing of console window after the execution of batch file. <ref>[https://www.computerhope.com/pausehlp.htm MS-DOS pause command help]</ref><ref>[https://stackoverflow.com/questions/988403/how-to-prevent-auto-closing-of-console-after-the-execution-of-batch-file windows - How to prevent auto-closing of console after the execution of batch file. - Stack Overflow]</ref>
* [https://coderwall.com/p/jexjlw/pause-on-error-in-batch-file Pause on error in Batch File (Example)]


== Application: Run the PHP script automatically at a specified time ==
== Application: Run the PHP script automatically at a specified time ==
Line 91: Line 86:


== Related articles ==
== Related articles ==
* [https://www.computerhope.com/echohlp.htm MS-DOS echo command help]
* [https://ss64.com/nt/exit.html Exit - Terminate a script - Windows CMD - SS64.com]
* {{kbd | key=<nowiki>PAUSE</nowiki>}} at the end of file to prevent auto closing of console window after the execution of batch file. <ref>[https://www.computerhope.com/pausehlp.htm MS-DOS pause command help]</ref><ref>[https://stackoverflow.com/questions/988403/how-to-prevent-auto-closing-of-console-after-the-execution-of-batch-file windows - How to prevent auto-closing of console after the execution of batch file. - Stack Overflow]</ref>
* [https://coderwall.com/p/jexjlw/pause-on-error-in-batch-file Pause on error in Batch File (Example)]
* [http://php.net/getopt PHP: getopt - Manual]
* [http://php.net/getopt PHP: getopt - Manual]
* [[Boot up Tasks]] / [[Boot up Tasks#自動執行程式 | 自動執行程式]]
* [[Boot up Tasks]] / [[Boot up Tasks#自動執行程式 | 自動執行程式]]


[[Category:Programming]] [[Category:PHP]]
[[Category:Programming]] [[Category:PHP]]

Navigation menu