PHP Command Line Scripting: Who said PHP was just for websites!?

Many people take for granted the power of knowing a good command line scripting language. Command Line scripting is a skill that EVERY programmer needs to know how to do. With command line scripting, you can truly use your computer as a powerful tool by literally taking that processor and wield it to your liking. Let's say you need to do a special task. Oh, just throwing something out there... like copy files from one directory to another, but ONLY files with the extensions *.mp3, *.wma, and *.ogg. In the past, to do such a task would either mean to do it by hand... or scan the internet and only HOPE that some lonely software writer wished to do the same thing and MAYBE JUST MAYBE posted his work as an open source project. Many times this doesn't happen. But, if you are a programmer, why not just do it yourself!? In comes the power of command line scripting. But what is the best scripting language out there... Well, that really depends on what you consider "best". For me, "best" would have to span across several categories. Portability, Ease of Use, Power, Functionality, and Support. Well, as far as I am concerned, there is only ONE language out there that tops out all of these categories, and that is PHP. Although, I am almost sure that I will get many arguments in favor of C... I will just tell you that, being a C programmer myself, l would rather write a PHP script over a C program any day!

With all these wonderful things to say about PHP, there is one HUGE drawback to using PHP as your command line scripting language... jumping through hoops just to RUN the script! With all of my experience with writing PHP scripts, this is the one thing that DROVE ME CRAZY... To iterate my point, here is what the average person has to do to start writing and running PHP command line scripts.

  • Download the PHP executable from PHP.net
  • Install the prgram on your machine
  • Set up my path environment variable to point to the installed PHP directory
  • Launching the Command Prompt and navigate to the directory in which you wrote your PHP script
  • Type php c:\myscripts\myscript.php to run my script


There's got to be a better way!

Of course, being a programmer, I am incredibly lazy. To lazy to do this every time for every script that I write. So, I did what everyone would have done in my situation. Wrote a PHP Command Line Utility!!! Basically all you have to do is just download the attached file, un-rar this file in any directory, add whatever scripts you want in the scripts directory, and then just double click on the PHP-CL.exe file in the base directory...AND THATS IT!!! Basically what this utility does is scans the entire scripts directory and then gives you a list of all PHP files in that directory. You just chose which one you want to run and hit enter. What's even more cool is you can still pass arguments to any of these scripts as you would if you had to type that long statement in the Command Prompt. So, download this file....test it out... and let me know what you think!! Oh, and read the Readme.txt file included. I go into great detail how the whole system works. Enjoy!


Special Bonus: I have also included in this download a means to actually compile your scripts into there very own stand-alone execuatable. For this, you just double click on the file that says compile.exe.


IMPORTANT NOTE: This is only meant for Microsoft Windows NT/2000/XP. If I have enough people request, I might include the PHP source that governs this program. But for now, this is only an executable that runs on Microsoft Windows NT/2000/XP

AttachmentSize
PHPUtility_v100.zip4.88 MB

This is only meant for

This is only meant for Microsoft Windows NT/2000/XP. If I have enough people request, I might include the PHP source that governs this program. But for now, this is only an executable that runs on Microsoft Windows NT/2000/XP
_________
women bags