I question Microsoft's documentation
-
Microsoft wrote:
You can use wildcard characters (* or ?), to represent one or more characters of a file name and to display a subset of files or subdirectories. The asterisk wildcard always uses short file name mapping, so you might get unexpected results. You can use the question mark (?) as a substitute for a single character in a name.
-- dir | Microsoft Learn[^] The question mark does not actually substitute for a dot/period/full stop (.) in a file name.
C:\Users\PIEBALD\AppData\Roaming>copy con foo_bar.txt
^Z
1 file(s) copied.C:\Users\PIEBALD\AppData\Roaming>copy con foo.bar.txt
^Z
1 file(s) copied.C:\Users\PIEBALD\AppData\Roaming>dir foo*bar.txt
Volume in drive C is Windows8_OS
Volume Serial Number is 528E-277CDirectory of C:\Users\PIEBALD\AppData\Roaming
2023-03-31 08:06 0 foo.bar.txt
2023-03-31 08:06 0 foo_bar.txt
2 File(s) 0 bytes
0 Dir(s) 28,516,610,048 bytes freeC:\Users\PIEBALD\AppData\Roaming>dir foo?bar.txt
Volume in drive C is Windows8_OS
Volume Serial Number is 528E-277CDirectory of C:\Users\PIEBALD\AppData\Roaming
2023-03-31 08:06 0 foo_bar.txt
1 File(s) 0 bytes
0 Dir(s) 28,516,675,584 bytes freeC:\Users\PIEBALD\AppData\Roaming>del foo*bar.txt
C:\Users\PIEBALD\AppData\Roaming>
As a further note, I have 8dot3 naming turned off on my personal system and I'll have to try this there. Tested on Win10 as well as this old Win8 junker.
-
Microsoft wrote:
You can use wildcard characters (* or ?), to represent one or more characters of a file name and to display a subset of files or subdirectories. The asterisk wildcard always uses short file name mapping, so you might get unexpected results. You can use the question mark (?) as a substitute for a single character in a name.
-- dir | Microsoft Learn[^] The question mark does not actually substitute for a dot/period/full stop (.) in a file name.
C:\Users\PIEBALD\AppData\Roaming>copy con foo_bar.txt
^Z
1 file(s) copied.C:\Users\PIEBALD\AppData\Roaming>copy con foo.bar.txt
^Z
1 file(s) copied.C:\Users\PIEBALD\AppData\Roaming>dir foo*bar.txt
Volume in drive C is Windows8_OS
Volume Serial Number is 528E-277CDirectory of C:\Users\PIEBALD\AppData\Roaming
2023-03-31 08:06 0 foo.bar.txt
2023-03-31 08:06 0 foo_bar.txt
2 File(s) 0 bytes
0 Dir(s) 28,516,610,048 bytes freeC:\Users\PIEBALD\AppData\Roaming>dir foo?bar.txt
Volume in drive C is Windows8_OS
Volume Serial Number is 528E-277CDirectory of C:\Users\PIEBALD\AppData\Roaming
2023-03-31 08:06 0 foo_bar.txt
1 File(s) 0 bytes
0 Dir(s) 28,516,675,584 bytes freeC:\Users\PIEBALD\AppData\Roaming>del foo*bar.txt
C:\Users\PIEBALD\AppData\Roaming>
As a further note, I have 8dot3 naming turned off on my personal system and I'll have to try this there. Tested on Win10 as well as this old Win8 junker.
-
To be fair, they do warn you that the * uses the 8.3 filename. I guess the ? does as well. Use dir /X to get the 8.3 filenames.
Yet the 8dot3 names don't seem to make a difference -- it behaves the same whether 8dot3 names are enabled on the volume or not. Or maybe it generates 8dot3 names on-the-fly as needed but doesn't store them?
-
Microsoft wrote:
You can use wildcard characters (* or ?), to represent one or more characters of a file name and to display a subset of files or subdirectories. The asterisk wildcard always uses short file name mapping, so you might get unexpected results. You can use the question mark (?) as a substitute for a single character in a name.
-- dir | Microsoft Learn[^] The question mark does not actually substitute for a dot/period/full stop (.) in a file name.
C:\Users\PIEBALD\AppData\Roaming>copy con foo_bar.txt
^Z
1 file(s) copied.C:\Users\PIEBALD\AppData\Roaming>copy con foo.bar.txt
^Z
1 file(s) copied.C:\Users\PIEBALD\AppData\Roaming>dir foo*bar.txt
Volume in drive C is Windows8_OS
Volume Serial Number is 528E-277CDirectory of C:\Users\PIEBALD\AppData\Roaming
2023-03-31 08:06 0 foo.bar.txt
2023-03-31 08:06 0 foo_bar.txt
2 File(s) 0 bytes
0 Dir(s) 28,516,610,048 bytes freeC:\Users\PIEBALD\AppData\Roaming>dir foo?bar.txt
Volume in drive C is Windows8_OS
Volume Serial Number is 528E-277CDirectory of C:\Users\PIEBALD\AppData\Roaming
2023-03-31 08:06 0 foo_bar.txt
1 File(s) 0 bytes
0 Dir(s) 28,516,675,584 bytes freeC:\Users\PIEBALD\AppData\Roaming>del foo*bar.txt
C:\Users\PIEBALD\AppData\Roaming>
As a further note, I have 8dot3 naming turned off on my personal system and I'll have to try this there. Tested on Win10 as well as this old Win8 junker.
The documentation you cite was proofread poorly. They refer to "
dir t97\*
" several times rather than "dir t97.*
".Software Zen:
delete this;