One big annoyance about programming under Windows is cmd.exe's inability to directly execute scripts. Under UNIX, all you need to do to make a Python or shell script executable is set the "execute" flag and change the first line so it contains "#!" followed by the script engine. Under Windows, you can double-click to launch scripts, but running them from the shell is more problematic.
scriptrun is the answer! Just copy it into the same directory as the script and rename it to <<scriptname>>.exe. Now you can just run <<scriptname>> from the command-line. scriptrun takes care of the rest.
Highlights of scriptrun:
The scriptrun web page is here:
http://www.midwinter.com/~larry/programming/scriptrun/And you can download a fresh copy of it here, including full source:
Here's the thirty-second description of how to use scriptrun. Let's say you have a script called useful.py. Follow these steps:
scriptrun only itself recognizes one argument:
foo -sr:-v, and the
-vwould get passed in as so:
python.exe -v foo.py
|How scriptrun Finds Its Script|
scriptrun follows these steps to find the script:
|How scriptrun executes the script|
scriptrun follows these steps to decide on the command-line it will run:
SCRIPTRUN_<<extension>>(where <<extension>> does not include the leading period) it uses that. So, for instance, you can set
SCRIPTRUN_PYto change how scriptrun executes Python scripts.
Here's the license:
/* ** [BEGIN NOTICE] ** ** Copyright (C) 2005 Larry Hastings ** ** This software is provided 'as-is', without any express or implied warranty. ** In no event will the authors be held liable for any damages arising from ** the use of this software. ** ** Permission is granted to anyone to use this software for any purpose, ** including commercial applications, and to alter it and redistribute ** it freely, subject to the following restrictions: ** ** 1. The origin of this software must not be misrepresented; you must not ** claim that you wrote the original software. If you use this software ** in a product, an acknowledgment in the product documentation would be ** appreciated but is not required. ** 2. Altered source versions must be plainly marked as such, and must not be ** misrepresented as being the original software. ** 3. This notice may not be removed or altered from any source distribution. ** ** The scriptrun homepage is here: ** http://www.midwinter.com/~larry/programming/scriptrun/ ** ** [END NOTICE] */In non-legalese, my goal was to allow you to do anything you like with the software, except claim that you wrote the original version. If my license prevents you from doing something you'd like to do, contact me (my email address is in the source) and we can discuss it.