Bengt Richter wrote: >>>And there is a PATHEXT environment variable, >> >>Aha. You'bve provided a significant clue. >> >>What you need to do is include the following line in autoexec.bat: >>set .py=c:\python24\python.exe >> >>This will achieve the desired result. I'm suprised more people don't use it. > > I wasn't aware of that syntax for set. What OS/platform/shell is that from?
Windows XP, bog-standard default shell. UNIXers have it easy because they can use the normal "shebang". > How did you go from the PATHEXT "clue" to the set command you specify I can't remember. It was a bit of luck, I think. I happened upon: http://www.jpsoft.com/help/index.htm?exeext.htm probably as a result of Googling for PATHEXT. > and decide > not to set pathext, e.g., by something like > set PATHEXT=%PATHEXT%;.py > Does your set do the pathext and assoc and ftype all in one swell foop? Actually, I haven't figured out what PATHEXT is actually supposed to "do". It seemed to me that Windows couldn't possibly know that a py file should be started by python.exe, whereas my set .py= ... would. I had installed python 2.4 in the standard way, so py files were already associated with python when you double-clicked them from Explorer. Using my set meant that if I wanted to use py files from the command line, I could just type out the script name (you have to be in the right directory, of course), and it works. Here's a snippit from my autoexec.bat files: set PATH=C:\python24;%PATH% set .py=c:\python24\python.exe -- http://mail.python.org/mailman/listinfo/python-list