Last active
October 13, 2020 11:03
-
-
Save DenesKellner/94c69ca32d437bd3b23a6be7170c56c3 to your computer and use it in GitHub Desktop.
A simple php file that's also a valid Windows batch; it will run itself, that is, whatever php is contained inside. This may be the simplest possible way to create command line php batches that look like real console commands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @rem <?php /* | |
| @d:\yada\yada\bin\php "%~dpnx0" %* & exit /b & rem */print "\r \r"; | |
| //-------------------------------------------------------------------------------------------------------------------- | |
| // Make sure you replace the "d:\yada\yada\bin\php" with your real php.exe path | |
| //-------------------------------------------------------------------------------------------------------------------- | |
| print "This is a PHP script that looks like a batch.\n"; | |
| print "Anything that's below the line is normal PHP, you can write your script here.\n"; | |
| print "In fact, let's count to ten:\n"; | |
| for($c=0;$c++<10;) print "$c, "; | |
| print "... see? your script is working!\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment