Wildcards

The * wildcard will match any sequence of characters
               (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
??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

Wildcards will match both Short and Long filenames

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

DIR /X

      2002-05-12 01:12 96 DIABLO~1 diablo1640
      2002-05-12 01:12 96 DIABLO~2 diablo1641
      2002-05-12 01:12 96 DIABLO~3 diablo1642
      2002-05-12 01:12 96 DIABLO~4 diablo1643
      2002-05-12 01:12 96 DIE359~1 diablo1644
      2002-05-12 01:12 96 DIC49C~1 diablo1648
      2002-05-12 01:12 96 DIF2E9~1 diablo1740
      2002-05-12 01:12 96 DIE2EF~1 diablo1649

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 right in the middle.

Wildcards are supported by the following commands:
ATTRIB, CACLS, COPY, DEL, DIR, EXPAND, EXTRACT, FOR, FORFILES, FTP, MOVE, MUNGE, MV, NET (*=Any Drive), PERMS, PRINT, QGREP, REN, ROBOCOPY, ROUTE, TYPE, WHERE, XCACLS, XCOPY

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

Related:

FINDSTR
Long and short filename issues



Back to the Top

© Copyright SS64.com 1999-2012
Some rights reserved