@echo off

if [%~1] == [] goto Usage
set "User=%~1"


call IsInstalled
if %errorlevel% equ 0 (
    @REM echo Found: VC++ Redistributable 2015 (x86) appears to be installed
    start "" cmd /c "echo Found: VC++ Redistributable 2015 (x86) appears to be installed&echo(&pause"
) else (
    @REM echo Not found: VC++ Redistributable 2015 (x86) does not appear to be installed
    start "" cmd /c "echo Not found: VC++ Redistributable 2015 (x86) does not appear to be installed&echo(&pause"
)

:IsInstalled

@REM 2015 x86 (14.0.24215)
reg query "HKLM\SOFTWARE\Classes\Installer\Dependencies\{e2803110-78b3-4664-a479-3611a381656a}" >nul 2>&1
if %ERRORLEVEL% equ 0 (
    goto Found
)

@REM 2017 x86 (14.16.27012)
reg query "HKEY_CLASSES_ROOT\Installer\Dependencies\VC,redist.x86,x86,14.16,bundle\Dependents\{67f67547-9693-4937-aa13-56e296bd40f6}" >nul 2>&1
if %ERRORLEVEL% equ 0 (
    goto Found
)

@REM 2019 x86 (14.21.27702)
reg query "HKEY_CLASSES_ROOT\Installer\Dependencies\VC,redist.x86,x86,14.21,bundle\Dependents\{49697869-be8e-427d-81a0-c334d1d14950}" >nul 2>&1
if %ERRORLEVEL% equ 0 (
    goto Found
)

@REM 2019 x86 (14.22.27821)
reg query "HKEY_CLASSES_ROOT\Installer\Dependencies\VC,redist.x86,x86,14.22,bundle\Dependents\{5bfc1380-fd35-4b85-9715-7351535d077e}" >nul 2>&1
if %ERRORLEVEL% equ 0 (
    goto Found
)

@REM 2022 x86 (14.36.32532)
reg query "HKEY_CLASSES_ROOT\Installer\Dependencies\VC,redist.x86,x86,14.36,bundle\Dependents\{410c0ee1-00bb-41b6-9772-e12c2828b02f}" >nul 2>&1
if %ERRORLEVEL% equ 0 (
    goto Found
)

exit /b 1


:Usage
echo %~n0 [/i]
echo Options:
echo /i     Interactive

:Found
exit /b 0