Registry query for batch script
I am trying to create a batch script, (only specifically batch script), to check if the latest Microsoft Office version is installed to my computer. If it detects the latest version, it will output hello, else it will output heyo. However, the if else statement doesn't seem to be working as I kept receiving the echo "heyo" even when the correct version of Office is installed.
Appreciate all the help I can get, thanks!
Script:
@echo off
for /f "skip=1 tokens=3 delims= " %%a in (
'reg query "HKEY_LOCALMACHINE\SOFTWARE\Microsoft\Office\Click ToRun\Configuration" /v VersionToReport'
) do (
set "VersionToReport=%%~a"
)
IF "%VersionToReport%" EQU "16.0.10396.20023" (
echo hello
) else (
echo heyo
)
|