@ECHO OFF

:: Workaround for Installation Incomplete due to issues with Microsoft Visual C++ 2010  x64 Redistributable
:: Version 1.1

ECHO This tool will attempt to correct the Microsoft Visual C++ 2010  x64 Redistributable Package
PAUSE

SET ATL=%WINDIR%\SYSTEM32\atl100.dll
SET VCP=%WINDIR%\SYSTEM32\msvcp100.dll 
SET VCR=%WINDIR%\SYSTEM32\msvcr100.dll
SET THIS=%RANDOM%

IF EXIST %ATL% REN atl100.dll atl100.dl%THIS%
IF EXIST %VCP% REN msvcp100.dll msvcp100.dl%THIS%
IF EXIST %VCR% REN msvcr100.dll msvcr100.dl%THIS%

:: TEST FOR x64 VS 2010 C++ Runtime
REG QUERY HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1D8E6291-B0D5-35EC-8441-6616F567A0F7}>nul
IF %ERRORLEVEL%==0 (SET X64=TRUE) ELSE (SET X64=FALSE)
IF %X64%==FALSE GOTO MSG
START /WAIT MsiExec.exe /X{1D8E6291-B0D5-35EC-8441-6616F567A0F7}

:INST
IF NOT EXIST .\vcredist_x64.exe GOTO FNF
START /WAIT .\vcredist_x64.exe
GOTO END

:MSG
ECHO Runtime not installed. No need to run uninstall command
GOTO INST

:FNF
ECHO VCREDIST_X64.EXE is not on the system.
PAUSE
GOTO EOF

:END
ECHO All tasks completed 
PAUSE
EXIT