Tech 2 months ago

Why Window Won't allow you to use certain characters in a file name

Why Window Won't allow you to use certain characters in a file name

If like most of us, you use windows at some point, you've probably gotten a notification that looks like this telling you that you can't use certain characters in a file name, but why? I mean, quotes and question marks are common enough in everyday use. So why can't I just put them in that regard? What the heck is going on? Is Microsoft just trying to play mind games with us or do they actually have a good reason?


It turns out these restrictions are due to how the operating system itself reads file names. You see Windows users, certain characters to denote certain actions the operating system needs to follow when it's working with a file. You're probably familiar with how backslash precedes the name of a subfolder and as such, you cannot put a backslash in the file name since otherwise Windows would confuse the file name for another folder that isn't even there.


Similarly, you can't use a colon since Windows understands a colon to denote a drive letter, which comes at the beginning of a file path to tell Windows what drive to begin looking for the file on. What about Forward Slash? Well, these can still be used to point to certain resources. Think about how you can have a shortcut on your desktop to a certain webpage that uses forward slashes in the URL.


The questionmark, ironically, has the potential to cause Windows some confusion as well. You can actually use it as a wild card of sorts when you run a search. For example, if you want to find all the files that match most of a certain file name, you can throw in a question mark to tell Windows to return a result for any character in that space where the question mark is. So it follows that you simply can't use it in your file names.


Oh, and the asterisk is restricted for similar reasons, as if you search for something like Asterix PMG, you'll get all PMG files in whichever folder you're searching. Moving on, quotation marks are disallowed because Windows reserves them to indicate a full path if the path itself has a space in it. If you bring up a window shortcut, you can see that the path it's pointing to will often include quotes by default. This is especially useful if you're trying to put modifiers after the path.


For example, if you're trying to force a game to run in a certain sized window, you can try putting a space after the filename, then hyphen W, hyphen R, followed by your desired resolution. The quotes help Windows know that the space after the filename isn't part of the path and that you're instead trying to tell Windows to do something else. And there are other disallowed characters that you may not see unless you're using the command line.


Instead of the typical Windows guey. The greater and less than symbols fall into this category, for example, for the other characters and uses that we don't have time for today.


I'm sure some of you can discuss those in the comments and help us out. Of course, Windows approach to this isn't always super intuitive, which is why the frustration stems to begin with.


You can still use periods in a file name, even though the last period denotes the beginning of the extension, which tells Windows what kind of file it is. So that's a little inconsistent. And why can't you, for example, use a colon later on in the file name, as it's typically just the first one in the path that denotes a drive letter? Sometimes characters are restricted simply to avoid confusion. And I get this can be frustrating, but you can always substitute my personal favorite, the semicolon.



Whats your Reaction