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
set "fileExist="
for %%a in (d:\*Backup*.*) do set "fileExist=1" & goto continue
:continue
IF DEFINED fileExist (
ECHO "file exist"
) ELSE (
ECHO "file not exist"
)
4条答案
按热度按时间2izufjch1#
您也可以使用未记录的通配符来实现此目的。
在以下两个链接中详细讨论了此通配符选项和其他选项。http://www.dostips.com/forum/viewtopic.php?t=6207
http://www.dostips.com/forum/viewtopic.php?f=3&t=5057
从这些链接:
e5njpo682#
使用此命令;它适用于任何特定模式:
muk1a3rh3#
这是另一种选择。
6mzjoqzu4#
*.*
相当于dos中的*
。它只是表示“任何东西”,而不是“任何东西-句点-任何东西”。要检查目录,请尝试以下操作: