48 lines
1.2 KiB
Batchfile
48 lines
1.2 KiB
Batchfile
@Echo off
|
|
SET VCDIR=%~dp0
|
|
cd %VCDIR%\..
|
|
SET SEDPARENTDIR=%cd%
|
|
|
|
if exist "%PROGRAMFILES(X86)%" (set arch=x64) ELSE (set arch=x86)
|
|
|
|
"%windir%\system32\reg.exe" query "HKU\S-1-5-19" >nul 2>&1 && (
|
|
goto :checkok
|
|
) || (
|
|
echo -------
|
|
echo *** WARNING ***
|
|
echo -------
|
|
echo.
|
|
echo.
|
|
echo ADMINISTRATOR PRIVILEGES NOT DETECTED!
|
|
echo ______________________________________
|
|
echo.
|
|
echo This script must be able to run with administrator
|
|
echo privileges.
|
|
echo.
|
|
echo To do so, right click on this script and select 'Run As Administrator'
|
|
echo.
|
|
echo.
|
|
echo Press any key to exit...
|
|
pause >nul
|
|
goto :eof
|
|
)
|
|
|
|
:checkok
|
|
|
|
if exist "%temp%\list.txt" (del "%temp%\list.txt")
|
|
|
|
echo Uninstalling existing Visual C++ %arch% Runtime Redistributables
|
|
echo (please wait as this process may take a few moments)
|
|
|
|
wmic product where "name like 'Microsoft Visual C++ 2005 Redistributable%%'" get name >>"%temp%\list.txt"
|
|
|
|
%SEDPARENTDIR%\gnu\sed.exe -e 's/[ \t]*$//' -i "%temp%\list.txt"
|
|
|
|
for /f "usebackq skip=1 delims=" %%a in ('type "%temp%\list.txt"') do (wmic product where name='%%a' call uninstall /nointeractive)
|
|
|
|
del "%temp%\list.txt"
|
|
|
|
"%windir%\system32\msiexec.exe" /i %VCDIR%\vcredist.msi /q %VCDIR%\transforms=2k5-x64.mst
|
|
|
|
:eof
|