Why can't I use punctuation in a file name?

MLStrand56 complained to the Windows forum about Windows' inability to save file names containing punctuation.

[Email your tech questions to answer@pcworld.com or post them on the PCW Answer Line forum.]

Actually, the problem isn't anywhere near as serious as some might think. Of the 32 punctuation characters available on your keyboard, all but nine can be used in file names.


The nine that can't are:

  • \
  • /
  • :
  • *
  • ?
  • "
  • |

On the other hand, if you use Microsoft Word, you might think that all punctuation is blocked. Here's why:

Click for full size

When you save a new file in Word, the program brings up the Save As dialog box, and inserts the document's opening text as a likely file name. But Word truncates that text at the very first punctuation mark it finds. In other words, if your document starts with the title Pilgrim's Progress, Word will suggest you save the file as Pilgrim.But you don't have to accept that. You can type or paste in the full name, with the apostrophe, and save the file.

But you still can't save a file with one of those nine characters. Why?

Windows, like DOS before it, uses these symbols for searches, command-line instructions, and the paths that define file locations. For instance, I'm currently writing in a file called November Answer Line.docx, inside my 1211 folder, which is inside my Dropbox folder, inside Documents, inside Lincoln, on my D: drive. The file's full path, including the name, is D:\Lincoln\Documents\Dropbox\1211\November Answer Line.docx.

If I could rename the file November\Answer:Line.docx, Windows wouldn't know if November was a folder or part of the file name. To avoid that confusion, the OS simply bans the backslash (\) from file names.

Frankly, I wish Microsoft was stricter about this sort of thing, and didn't allow us to use periods (.) in file names.

In every file name, a period separates the name, which tells you what's in the file, from the extension, which tells Windows what type of file it is. Since Windows, by default, hides extensions, an extra period in the file name can make one type of file look like another.

Malware developers like that trick. As recently as September, the Trojan Troj/Backdr-HG spread with the help of a file called Microsoft-Services-Agreement.pdf.exe, which looked to many users like Microsoft-Services-Agreement.pdf.

People thought they were opening a .pdf, when they were really launching a program.

Read the original forum discussion.

Subscribe to the Windows Tips & Trends Newsletter

Comments