Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 如何找到“*”。“呃”;批处理文件中是否存在文件类型_Windows_Batch File_Cmd_Label_Errorlevel - Fatal编程技术网

Windows 如何找到“*”。“呃”;批处理文件中是否存在文件类型

Windows 如何找到“*”。“呃”;批处理文件中是否存在文件类型,windows,batch-file,cmd,label,errorlevel,Windows,Batch File,Cmd,Label,Errorlevel,如何在批处理文件中找到*.err文件类型存在或不存在。我使用以下代码来查找文件类型的存在 if [ -f $"*.err" ] then echo "File Type exists" else echo "File Type does not exists" fi 我认为这个代码不准确。是否可以更正此错误以查找文件类型的存在?在批处理文件中,脚本如下所示: @Echo off Rem DistPath Is Where you Want to check for file ty

如何在批处理文件中找到*.err文件类型存在或不存在。我使用以下代码来查找文件类型的存在

if [ -f $"*.err" ]
then
   echo "File Type exists"
else
   echo "File Type does not exists"
fi

我认为这个代码不准确。是否可以更正此错误以查找文件类型的存在?

在批处理文件中,脚本如下所示:

@Echo off

Rem DistPath Is Where you Want to check for file type
Set "DistPath=%UserProfile%\Desktop"
If Exist "%DistPath%\*.err" ( Echo File Type exists
) Else (
      Echo File Type does not exists
)
pause
编辑:

试试这个&在“ExecuteFlag”和“Goto EOF”之间添加需要执行的代码

然后添加其余的代码,假设您没有找到该文件。 因此,如果文件存在,代码将结束,否则它将根据您的代码处理缺少的文件类型

我想在当前目录中查找.err文件类型,如果文件类型存在,则我想存在,否则我想继续执行。。所以我使用了If Exist“.err”(goto FAIL)…这行执行不正确
@Echo off

If Exist "*.err" ( 
    Goto EOF
) Else (
    Goto ExecuteFlag
)
pause
Exit

Rem Put Your Code Down Here
:ExecuteFlag
<<< Your Code Here >>>

Goto EOF
If Exist "*.err" Goto :EOF