By registering with us, you'll be able to discuss, share and exchange private messages with other members of our community.

SignUp Now!

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

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​

, 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?
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:

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.