How to? (un)Sorted Environment Variables and executable extensions using wildcards

Jan 22, 2009
10
0
#1
I have been using JP Software products for over 20 years. Most of my work was with 4DOS, but I'm now working with TCC/LE and TCMD.

In 4DOS if you entered, for example,

SET .txt=notepad.exe​
SET .*=LIST​
README.TXT​

, then notepad would execute and load README.TXT . Any other non-.TXT file would cause LIST (the "default") to execute.

In WinXP (and Vista and Win7 and Win8?), the environment is sorted, so the "default" .* executable extension becomes the "ONLY" executable extension. In the example above, all file.ext would be LISTed, including README.TXT ! SETting any other executable extensions would also be overridden by the .* value. Also... using other wildcard variable names (example .tx?) also causes "overrides" regardless of when they are SET.

Is there any way to make executable extensions using wildcards work like they used to?

Can TCC be modified to use the environment in its unsorted form?
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,659
46
Albuquerque, NM
prospero.unm.edu
#2
There is no 'unsorted' environment in NT; the environment is always kept sorted for speed reasons. But brackets come after the alphabet, so you could do something like this:

Code:
set .txt=notepad.exe
set .[?]*=list
That said, I suggest reconsidering the whole strategy of making everything executable. If nothing else, it's going to dumb down filename completion at the start of the command line. It might be simpler in the long run to create one-letter aliases for LIST, START, and so on.