Introduction
In Windows operating system environments, there exist forbidden file names that cannot be used to name files, and also certain characters that cannot be used in filenames.
Task [top]
Identify forbidden characters, and understand why you cannot use them.
Implementation [top]
The following are (case insensitive) reserved names which cannot be assigned to a directory or file in Windows:
- CON
- PRN
- AUX
- NUL
- COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, COM0
- LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9, LPT0
The following are special characters which cannot be used in a directory or file names in Windows:
- < (less than)
- > (greater than)
- : (colon)
- “ (double quote)
- / (forward slash)
- \ (backslash)
- | (vertical bar or pipe)
- ? (question mark)
- * (asterisk)
How it works [top]
The reserved names mentioned above cannot be used to name a file or directory. The special characters mentioned above cannot be used in a file or directory name.
This is because they are reserved by the Windows operating system and are used to distinguish certain functions within the file system and legacy hardware that Windows needs in order to function.