2

Why can we not use any special characters (?, <..) in a Windows filename?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Kapil
  • 9,469
  • 10
  • 40
  • 53
  • http://en.wikipedia.org/wiki/Filename – zengr Oct 28 '10 at 05:35
  • Because they have special meanings like input/output redirection, drive letter delimiter, 32k Unicode name support etc – Remus Rusanu Oct 28 '10 at 05:36
  • similar [What characters are forbidden in Windows and Linux directory names?](https://stackoverflow.com/questions/1976007/what-characters-are-forbidden-in-windows-and-linux-directory-names) – milahu Jan 03 '22 at 20:11
  • More specifically, *"[Reserved characters and words, In Windows](https://en.wikipedia.org/wiki/Filename#In_Windows)"* – Peter Mortensen May 05 '23 at 21:40

3 Answers3

5

Fundamental rules for Universal Naming Convention (UNC), which enable applications to create and process valid names for files and directories, regardless of the file system:

The following reserved characters:

  • < (less than)
  • > (greater than)
  • : (colon)
  • " (double quote)
  • / (forward slash)
  • \ (backslash)
  • | (vertical bar or pipe)
  • ? (question mark)
  • * (asterisk)

Use any character in the current code page for a name, including Unicode characters and characters in the extended character set (128–255).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sudantha
  • 15,684
  • 43
  • 105
  • 161
  • This lists the characters (which is useful), but it doesn't answer the question (*** *** *** ***why*** *** *** ***). Whether that is a useful question is another matter. – Peter Mortensen May 05 '23 at 21:54
3

Because they have special meanings in the filesystem:

C:*.? - get all files with single letter extensions from the C drive

: \ * ? - all have special meanings

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Riho
  • 4,523
  • 3
  • 33
  • 48
0

Since some characters are reserved characters in some operating systems, say ? is used as a wildcard, and / as a path name component separator.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ads
  • 6,681
  • 12
  • 47
  • 72