Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.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
If statement IF语句中的多个命令_If Statement_Batch File - Fatal编程技术网

If statement IF语句中的多个命令

If statement IF语句中的多个命令,if-statement,batch-file,If Statement,Batch File,能否在If命令中放置多个命令? 我所做的是查看是否安装了某些东西,如果安装了,则向文件发送文本并更改变量。 我的示例是,假设您想查看是否安装了edge。。。。 设置边=N If exist "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" ( echo Edge is installed >> C:\Temp\Message.txt ) Else ( echo Edge is Not

能否在If命令中放置多个命令? 我所做的是查看是否安装了某些东西,如果安装了,则向文件发送文本并更改变量。 我的示例是,假设您想查看是否安装了edge。。。。 设置边=N

If  exist "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"  (
 echo Edge is installed >> C:\Temp\Message.txt
) Else (
echo Edge is Not installed >> C:\Temp\Message.txt
)
如果安装了Set Edge=Y,我需要将它放在哪里

If  exist "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"  (
 echo Edge is installed >> C:\Temp\Message.txt
 SET "EDGE=Y"
) Else (
SET "EDGE=N"&echo Edge is Not installed >> C:\Temp\Message.txt
)
两种方式

在括号内的块中,可以将任意数量的语句放在单独的行中

或者,您可以使用
&
在一行上放置多个命令