Avatar of Newbie0000
Newbie0000
Flag for Canada

asked on 

Correct way to use if / else command

Help with syntax please.

I am looking for a reg key and if it's there great put a flag file in if it's not install from a network share, just not sure how to use the else command.

reg query "HKEY\xxx\xxx\Uninstall\{xxxx}"
     if %errorlevel% EQU 0 (
     echo %date% %computername% Installed >> "C:\Windows\System32\Flags\xxx.txt"
     )

This is where I would like to put "Else" install "\\server\share\xxx.cmd" /qn

I'm not sure how to use the else command

I am very new to scripting and you help is appreciated.
Windows BatchWindows 7Microsoft DOS

Avatar of undefined
Last Comment
Newbie0000

8/22/2022 - Mon