Wildcards

The * wildcard will match any sequence of characters
(0 or more, including NULL characters)
The ? wildcard will match a single character
(or a NULL at the end of a filename)

A few quirks affect the operation of wildcards which are best illustrated
by example:

To match the filename BAR.TXT any of the following patterns will match
?AR.TXT
BAR.*
??R.TXT
B?R.???
BA?.TXT
BA??.TXT

However the following will fail to match with BAR.TXT
??AR.TXT
?BAR.TXT
B??AR.TXT

Wildcard matching rules

* Generally matches any 0 or more characters, with one exception (see next rule). The non-greedy wildcard is free to match as many or as few characters as are necessary for the remainder of the mask to match.

*. At end of mask matches any 0 or more characters except for {dot}. In actuality, the rule applies with any number of {dot} and {space} characters between the * and terminal {dot}. The regular expression for this term is "[*][. ]*[.]$"

? Match 0 or one character, except for {dot}.
The only time it matches 0 characters is when it matches the end of the name, or the position before a {dot}.
The question mark can also be used more than once to match more than one character.

Wildcards match both the Short and Long filename

The command DIR /X will reveal short filenames if they exist, where many similar names exist
in the same folder the short file name (SFN) will not always be an obvious contraction
of the long name. e.g.

As you can see, the first four short filenames follow the usual numeric tails (~1, ~2,
~3, ~4).
Then, from fifth and more files with similar beginning, the short names
have four hex digits in the middle. This is actually a hex checksum of the long filename. (If you need a true file checksum look at CertUtil -hashfile)

The commands COPY and REN accept two sets of wildcards, there are some subtle differences between how these are treated, see the REN page for details.

Undocumented Wildcards

The two undocumented wildcards, < and > can be used with commands like DIR and COPY, or to supply a command name but only if quoted: DIR /b "<demo<"

< Matches any 0 or more characters in either the base name or the extension, but never both.
Unlike the * wildcard, a single < cannot match characters in both the base name and the extension.
The {dot} is considered to be part of the base name, not the extension. There is one exception - If the name consists solely of an extension, without a base name, then the {dot} is considered to be part of the extension. This non-greedy wild card is free to match as many or as few characters as are necessary for the remainder of the mask to match.

> Is identical to ?. The only difference is that it can be placed after a {dot} to prevent the {dot} from matching the end of the name.

For many purposes a 4 byte signed integer value ranging from -2,147,483,648 to 2,147,483,647 will suffice, but in the above contexts it is also possible to express the numbers in hexadecimal or octal notation.

e.g. Octal: 00, 07 Hex: 0x00, 0xFF

There are a number of subtle differences (Negative numbers, command, version of Windows) which affect how these numbers are parsed and these are described in the DosTips forum thread Rules for how CMD.EXE parses numbers.

“We usually see only the things we are looking for, so much that we sometimes see them where they are not” ~ Eric Hoffer