Mar*_*ins 5

你可以使用exist:

if exist somefile.dat echo It exists
Run Code Online (Sandbox Code Playgroud)

根据"方言",您可以使用else语句.但是,在最低级别,一些相当丑陋的逻辑工作:

if exist somefile.dat goto fileexists
echo file does not exist
goto alldone

:fileexists
echo file exists

:alldone
Run Code Online (Sandbox Code Playgroud)