Code: Select all
<
Code: Select all
>
Please someone can provide the link to the post?.
Moderator: DosItHelp
Code: Select all
<
Code: Select all
>
Code: Select all
The following wildcard characters can be used in the pattern string.
Wildcard character Meaning
* (asterisk)
Matches zero or more characters
? (question mark)
Matches a single character
"
Matches either a period or zero characters beyond the name string
>
Matches any single character or, upon encountering a period or end of name string, advances the expression to the end of the set of contiguous >
<
Matches zero or more characters until encountering and matching the final . in the name
Code: Select all
a
bbb
Code: Select all
C:\dev>dir /b ">"
a
Code: Select all
C:\dev>dir /b "<"
a
bbb
Code: Select all
| | GREEDY NATURE
file | "??.??.??" | ">>.>>.>>" | "?a?.??.??" | ">a>.??.??"
----------------+------------+------------+-------------+-------------
a | match | no match | no match | no match
ab | match | no match | no match | no match
abc | no match | no match | no match | no match
a.1 | match | no match | no match | no match
ab.12 | match | no match | no match | no match
abc.123 | no match | no match | no match | no match
a.1.x | match | match | no match | no match
ab.12.xy | match | match | no match | no match
abc.123.xyz | no match | no match | no match | no match
a.1.x.7 | no match | no match | no match | no match
ab.12.xy.78 | no match | no match | no match | no match
abc.123.xyz.789 | no match | no match | no match | no match
| NON-GREEDY
file | "*.*.*" | "*." | "**." | "abc.*." | "*a*"
----------------+----------+----------+-------+----------+-----------
abc | match | match | match | match | match
abc.123 | match | no match | match | match | match
abc.123.xyz | match | no match | match | match | match
abc.123.xyz.789 | match | no match | match | match | match
| NON-GREEDY
file | "<.<.<" | "<" | "<<" | "abc.<" | "<a<" | "<a<<"
----------------+----------+----------+-------+----------+----------+--------
abc | no match | match | match | no match | match | match
abc.123 | no match | no match | match | match | no match | match
abc.123.xyz | match | no match | match | no match | no match | match
abc.123.xyz.789 | match | no match | match | no match | no match | match
dbenham wrote:@carlos - those rules are not quite right.
@npocmaka - I don't see how you resurrected that thread, unless you had it bookmarked. I had it bookmarked, but I forgot to look. But even if I had, I don't think I would have recognized the title as being relevent.
dir
if exist
cacls
type
move
del
cipher*
findstr* (output sets filename: before each line if the string is found)
Code: Select all
ftp
robocopy
where
forfiles
extrac32
expand
icacls*
more*
takeown*
find* (each filename that match the pattern in is printed like [color=#BF0000]---------- filename[/color] )
replace*
XCOPY - every time when ">" or "<" is passed it searches for *.* files but is unable to copy them
PRINT - I have no printer (tries with virtual pdf printer but it didnt work) so I couldn't test this.How can I set PRN device?
When using dots with "."/".." directories you only could add one unneeded dot:dbenham wrote:Any combination of trailing {dot} and {space} at end of mask can match the end of name (nothing).
Code: Select all
Z:\test>dir "..."
Datenträger in Laufwerk Z: ist Test
Volumeseriennummer: 0438-EEA7
Verzeichnis von Z:\test\..
24.01.2015 14:17 <DIR> .
24.01.2015 14:17 <DIR> ..
24.01.2015 14:17 3 .c
1 Datei(en) 3 Bytes
2 Verzeichnis(se), 133.076.926.464 Bytes frei
Z:\test>dir ....
Datenträger in Laufwerk Z: ist Test
Volumeseriennummer: 0438-EEA7
Verzeichnis von Z:\test\...
Datei nicht gefunden
Code: Select all
Z:\>dir "test."
Datenträger in Laufwerk Z: ist Test
Volumeseriennummer: 0438-EEA7
Verzeichnis von Z:\test
24.01.2015 14:48 <DIR> .
24.01.2015 14:48 <DIR> ..
0 Datei(en) 0 Bytes
2 Verzeichnis(se), 133.074.714.624 Bytes frei
Z:\>dir "test.."
Datenträger in Laufwerk Z: ist Test
Volumeseriennummer: 0438-EEA7
Verzeichnis von Z:\test.
24.01.2015 14:48 <DIR> .
24.01.2015 14:48 <DIR> ..
0 Datei(en) 0 Bytes
2 Verzeichnis(se), 133.074.714.624 Bytes frei
Z:\>dir "test..."
Datenträger in Laufwerk Z: ist Test
Volumeseriennummer: 0438-EEA7
Verzeichnis von Z:\test..
Datei nicht gefunden
Code: Select all
Z:\>dir "test.bat............................................................."
Datenträger in Laufwerk Z: ist Test
Volumeseriennummer: 0438-EEA7
Verzeichnis von Z:\
22.01.2015 14:24 405 test.bat
1 Datei(en) 405 Bytes
0 Verzeichnis(se), 133.074.714.624 Bytes frei
No, the dot seems to be part of the extension:dbenham wrote: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.
Code: Select all
Z:\>>".c" echo c
Z:\>dir "<"
Datenträger in Laufwerk Z: ist Test
Volumeseriennummer: 0438-EEA7
Verzeichnis von Z:\
24.01.2015 14:17 <DIR> .
24.01.2015 14:17 <DIR> ..
24.01.2015 14:17 3 .c
1 Datei(en) 3 Bytes
2 Verzeichnis(se), 133.076.926.464 Bytes frei
Code: Select all
C:\test2>md test
C:\test2>dir /b /ad "tes?.. .. . ."
test
Code: Select all
C:\test2>copy nul b.x
1 file(s) copied.
C:\test2>copy nul .x
1 file(s) copied.
C:\test2>copy nul .b.x
1 file(s) copied.
C:\test2>dir /b /a-d
.b.x
.x
b.x
C:\test2>dir /b /a-d "<"
.x
C:\test2>dir /b /a-d "<x"
.b.x
.x
b.x
C:\test2>dir /b /a-d "b<"
File Not Found
C:\test2>dir /b /a-d "<<"
.b.x
.x
b.x
C:\test2>dir /b /a-d "<b<"
File Not Found
Code: Select all
C:\test2>for %F in (b.x) do @echo baseName="%~nF" extension="%~xF"
baseName="b" extension=".x"
C:\test2>for %F in (.x) do @echo baseName="%~nF" extension="%~xF"
baseName="" extension=".x"
C:\test2>for %F in (.b.x) do @echo baseName="%~nF" extension="%~xF"
baseName=".b" extension=".x"
dbenham wrote:There is one exception: If the name consists solely of an extension, without a base name (...)
Liviu wrote:dbenham wrote:There is one exception: If the name consists solely of an extension, without a base name (...)
Just to nitpick, since it's pretty obvious what you meant in the context, but there is no such thing as a pathname that "consists solely of an extension, without a base name". Technically, a file ".x" has name ".x" and no extension. For example, "dir /x .x" will show a made-up SFN name and an empty SFN extension.
From the horse's mouth: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
- "All file systems follow the same general naming conventions for an individual file: a base file name and an optional extension, separated by a period" - which implies that the name is mandatory, the extension optional.
- "However, it is acceptable to specify a period as the first character of a name. For example, ".temp"." - which implies that ".temp" is the name.
Liviu wrote:That said, names like ".temp" are uncommon in Windows, and have always been confusing even to Microsoft's own. For example, one of the well respected MSDN blogs offers the following, which directly contradicts the formal spec: http://blogs.msdn.com/b/oldnewthing/archive/2008/04/14/8389268.aspx - "Such files are considered to have an extension but no name."
Code: Select all
C:\test>echo @echo It's alive!>".bat"
C:\test>.bat
It's alive!
C:\test>for %F in (.bat) do @echo baseName="%~nF" extension="%~xF"
baseName="" extension=".bat"
dbenham wrote:The tests that I ran indicate a name like ".bat" is an extension:
WowLiviu wrote:dbenham wrote:The tests that I ran indicate a name like ".bat" is an extension:
You wouldn't be the only one, as I pointed already. However, copy that ".bat" file to a plain FAT drive, then try run it from there - the SFN will have no extension, and will fail to execute. In other words, the low-level FS (file-system) guys followed the spec to the letter, while the high-level cmd/explorer guys played it by the ear. Not so much of a surprise there