echo 已安装的VC运行库版本
echo.
::64位系统system32是x64文件,32位系统system32是x86文件
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( set "system32=x64" ) else ( set "system32=x86" )
set "SharedDLLs=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs"
set "Wow6432Node_SharedDLLs=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\SharedDLLs"
:sxs :: <%1=version> <%2=filename> <%3=number>
set "VC=%1"
for /f "delims=" %%i in ('dir /a:d /b "%SystemRoot%\WinSxS\amd64_microsoft.vc%3.*"') do (
if exist "%SystemRoot%\WinSxS\%%i\%2" set "VC=!VC! x64"
)
for /f "delims=" %%i in ('dir /a:d /b "%SystemRoot%\WinSxS\x86_microsoft.vc%3.*"') do (
if exist "%SystemRoot%\WinSxS\%%i\%2" set "VC=!VC! x86"
)
echo %VC:"=%
goto :eof
:sysreg :: <%1=version> <%2=filename>
set "VC=%1"
reg query "%SharedDLLs%" /v "%SystemRoot%\System32\%2" 1>nul 2>nul
if %errorlevel% equ 0 (
for /f "tokens=2,*" %%i in ('reg query "%SharedDLLs%" /v "%SystemRoot%\System32\%2"') do (
if "%%j" == "0x1" ( if exist "%SystemRoot%\System32\%2" set "VC=!VC! !system32!" )
)
)
reg query "%Wow6432Node_SharedDLLs%" /v "%SystemRoot%\System32\%2" 1>nul 2>nul
if %errorlevel% equ 0 (
for /f "tokens=2,*" %%i in ('reg query "%Wow6432Node_SharedDLLs%" /v "%SystemRoot%\System32\%2"') do (
if "%%j" == "0x1" ( if exist "%SystemRoot%\SysWOW64\%2" set "VC=!VC! x86" )
)
)
echo %VC:"=%
goto :eof