maintain 2 versions of python on my computer

Duncan Booth duncan.booth at invalid.invalid
Fri Jan 22 12:15:28 EST 2010


aahz at pythoncraft.com (Aahz) wrote:

> In article <Xns9D02B5E2CD9B1duncanbooth at 127.0.0.1>,
> Duncan Booth  <duncan.booth at suttoncourtenay.org.uk> wrote:
>>
>>That seems overkill. This does pretty much the same thing:
>>
>>         @(C:\Python26\Python -x %~f0 %* || pause) && goto:EOF
>>         import sys
>>         print sys.version
>>         # raise RuntimeError # uncomment to trigger the 'pause'
> 
><blink>  What version of Windows is necessary to use this?  Anything with
> cmd.exe?  (Sure doesn't look anything like DOS batch files...)

Windows NT, Windows 2000, Windows XP, Windows Vista, Windows 7, Server 
2003, Server 2008 will all handle the && and || stuff. I didn't think that 
NT recognised the goto:EOF as special but a quick search with Google seems 
to indicate that it did. If so this script probably worked since 1993.[*]

Windows 7 still supports this cmd.exe syntax, but it also has Microsoft 
Powershell which seems to be Microsoft's latest answer to shell scripts and 
allows direct access to COM objects and .Net classes.

[*] or at least would have worked if Guido used his time machine to take a 
copy of Python 2.6 back to 1993. :^)



More information about the Python-list mailing list