June 17, 2009

The History of the Forbidden Character

Filed under: Main — admin @ 12:01 am

You can name a computer file using dozens of characters. Well, except for an annoying few.

Back before Windows 95, filenames on PCs were limited to only 8 characters. Yep, that was a pain, which is why Windows 95 took off so quickly: Windows 95 allowed much, much longer filenames.

Presently Windows lets you name files with tremendously long names. I don’t recall the exact number, but you can name your computer files something over 200 characters long. That’s pretty ridiculous, but it’s a welcome feature over the old 8 character limitation.

In my books, I tell my readers that they can use any combination of letters, numbers, or spaces to name a file. That’s the easy way to remember things. You can also use a smattering of symbols to name a file, but that’s where things get tricky; Windows doesn’t allow just any character to be used in a filename.

The current list of restricted characters is as follows: : ? " * / \ < > |

When you attempt to name a file using one of those character, you’ll get a warning from Windows. You won’t know which character is offensive; Windows simply bans the entire name and urges you to try again. That’s understandable, but why?

The characters are not really so much forbidden as they are reserved. That means that the characters have a special use in the operating system. Despite what you think you know, the fact is that Windows remains a command-line operating system, and those characters hold special meaning at the command prompt.

? and * These are filename wild cards, used to match single or multiple characters in a filename.

The double quote is used to enclose long filenames containing spaces.

/ The slash should be part of a filename, but it’s not. That’s because the slash is used to specify options for command line programs. (If you’re going to put a date in a filename, use a hyphen instead, or just crunch the date all up as I do: 20090617. That’s cryptic, but it sorts well.)

\ The backslash is used as a pathname separator, which identifies folders for Windows when it finds files.

< > and | These characters are used for input/output redirection at the command prompt.

A filename in Windows can contain as many spaces or periods as necessary, but no single space or period at the end of a filename. Further, the filenames . and .. are reserved as shortcuts to the current and parent folder, respectively.

There are also reserved filenames in Windows. These are the names of devices used at the command prompt: AUX, CLOCK$, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, CON, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9, NUL and PRN. You can’t name a file after any of those weird things.

Now with all that nonsense, you can see why my advice is simply put: name a file using letters, numbers, and spaces. That works.

2 Comments

  1. Dan, in XP and Vista, whenever you try to use a Forbidden Character in a dialog box, on the desktop or in Windows Explorer, it pops up a bubble to tell you that you can’t use the characters that are forbidden, as seen here: http://tinypic.com/r/wvsnck/5

    Comment by Douglas — June 18, 2009 @ 12:19 am

  2. True. Thanks!

    Comment by admin — June 18, 2009 @ 8:26 am

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.


Powered by WordPress