Thursday, March 10, 2011

Institutional Amnesia

Just received an email that said a folder in windows can just not be named 'con'. Sounds weird but turns out, it is true. I just can not name a folder 'con'.

It might appear to be inexplicable ... if you're not exposed to old DOS console.

A lot of the windows OS was constructed on top of the old DOS shell. Now DOS used unix style short-hand a fair bit. So in DOS, 'con' was short-hand for 'console' aka command prompt.

Now file editing happened in DOS even in the days before wordstar etc. This was done by telling the OS to copy the contents written on the console to a file like this -

copy con myfile.txt


This meant as follows -
copy = duplicate the contents
con = source of the contents = command prompt = console
myfile.txt = target name where the duplication will be retained to disk

Apparently the underlying code didn't change; just to illustrate the example try this on the windows command prompt -
copy con con
xyz

So when windows explorer tries to create a folder named 'con', in all probability it is still using the same old DOS code where 'con' is a keyword. Therefore attempts to use 'con' as a name are fruitless
, and hence the folder remains unnamed.

As a programmer, I'm in favour of code reuse. As an engineer, I believe in the age old adage - 'if it ain't broke, don't fix it!' The decision to reuse the known DOS shell code was fine as it was known to work well. But if Microsoft have to fix this now, how much effort will it require to change code no less than 20 years old?

No comments: