Windows 如果存在Do语句(批处理文件)

Windows 如果存在Do语句(批处理文件),windows,batch-file,Windows,Batch File,请有人给我举一个例子,比如: 如果test.txt存在,请启动test.txt,例如- IF EXIST test.txt start test.txt 您知道,如果/?,您可以执行;如果,您可以执行帮助 if exists file command 对于多个命令(或在使用else时),请使用括号将其括起来,即 if exists file ( command1 command2 ) @James:&&表示只有当command1进程的退出代码为0时,command2才会运行

请有人给我举一个例子,比如:

如果test.txt存在,请启动test.txt,例如-

IF EXIST test.txt start test.txt

您知道,如果/?,您可以执行
;如果
,您可以执行
帮助

if exists file command
对于多个命令(或在使用
else
时),请使用括号将其括起来,即

if exists file (
    command1
    command2
)

@James:&&表示只有当command1进程的退出代码为0时,command2才会运行,使用command1&command2运行command2不管怎样what@Anders谢谢你澄清这一点