maintain 2 versions of python on my computer
Alf P. Steinbach
alfps at start.no
Fri Jan 22 11:15:39 EST 2010
* Aahz:
> 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...)
Well, all of that has been there since, I don't know, long ago...
-x A Python option that skips the first line of the script.
@ suppresses echo of the line.
() group commands (creates a compound command)
|| shortcut-evaluated OR
&& shortcut-evaluated AND
% see below...
C:\test> for /? | find "%~"
%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~dI - expands %I to a drive letter only
%~pI - expands %I to a path only
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
%~sI - expanded path contains short names only
%~aI - expands %I to file attributes of file
%~tI - expands %I to date/time of file
%~zI - expands %I to size of file
%~$PATH:I - searches the directories listed in the PATH
%~dpI - expands %I to a drive letter and path only
%~nxI - expands %I to a file name and extension only
%~fsI - expands %I to a full path name with short names only
%~dp$PATH:I - searches the directories listed in the PATH
%~ftzaI - expands %I to a DIR like output line
values. The %~ syntax is terminated by a valid FOR variable name.
C:\test> _
Cheers & hth. (even if a bit off-topic!),
- Alf
More information about the Python-list
mailing list