hon*_*pei 2 windows cmd batch-file
在Windows批处理脚本中,通常我们可以找到if exist xxx或if not exist xxx。
这是否会搜索计算机中的所有文件或任何特定文件夹或路径以查找xxx指定的文件?
小智 5
如果您没有指定文件夹,它将在当前文件夹中查找。但您可以使用通配符。例子:
if exist *.png echo There are images here
Run Code Online (Sandbox Code Playgroud)
如果当前文件夹中有任何扩展名为 .png 的文件,将输出文本
或者您可以指定完整路径,例如
if exist d:\temp\*.png echo There are images there
Run Code Online (Sandbox Code Playgroud)