Multiple commands in a IF statement

Viewed 291

Can you put multiple commands in a If command? What I have is looking to see if something is installed and if it is, send text to a file and change a variable. My example is lets say you want to see if edge is installed.... Set 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
)

Where would I need to put the Set Edge=Y if it is installed?

1 Answers
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
)

Two ways.

Within a parenthesised block, you can place any number of statements you like, all on separate lines.

OR, you can use & to place a number of commands on one line.

Related