Understanding why the DIR command behaves this way
Why does:
dir "test.txt "
dir test.txt.
dir "test.txt . . ."
all lists test.txt with no error on Windows prompt? Are there any other suffix that are ignored by Windows?
(please note that I added space, dot to the end of the filename)
The Windows shell does not allow a file or folder name to end with dot or space. There are low level routines that automatically trim any trailing dots and/or spaces in many situations, including when used with DIR
.
I found the following confirmation that names cannot end with dot or space in a Microsoft's Windows Dev Center article: Naming Files, Paths, and Namespaces
Do not end a file or directory name with a space or a period. Although the underlying file system may support such names, the Windows shell and user interface does not. However, it is acceptable to specify a period as the first character of a name. For example, ".temp".