Bin*_*hen 3 windows dos batch-file
伪代码:
if file exists:
do
xxxx
done
else:
do
xxxx
done
Run Code Online (Sandbox Code Playgroud)
你可以使用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)