bat判断是否安装了VC的运行时库

VC2005

 1 @echo off
 2 set "HKLMU=HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstall"
 3 ::::: 判断系统是否已经安装了 Visual C++ 2005 (包括所有版本)        <a href="http://yusky.me/">http://yusky.me</a>  By:Yusky
 4 ::::: 代码能实现判断X86、X64、IA64各版本的Visual C++ 2005,正确率99%除非微软发布新版本Visual C++ 2005
 5 ::::: 有就跳过安装Visual C++ 2005,没有则先安装。
 6 reg query %HKLMU%{A49F249F-0C91-497F-86DF-B2585E8E76B7}&gt;nul 2&gt;nul&amp;&amp;set VC2005=Microsoft Visual C++ 2005 Redistributable X86
 7 reg query %HKLMU%{7299052B-02A4-4627-81F2-1818DA5D550D}&gt;nul 2&gt;nul&amp;&amp;set VC2005=Microsoft Visual C++ 2005 SP1 Redistributable X86
 8 reg query %HKLMU%{837b34e3-7c30-493c-8f6a-2b0f04e2912c}&gt;nul 2&gt;nul&amp;&amp;set VC2005=Microsoft Visual C++ 2005 SP1 Redistributable ATL Security Update X86
 9 reg query %HKLMU%{6E8E85E8-CE4B-4FF5-91F7-04999C9FAE6A}&gt;nul 2&gt;nul&amp;&amp;set VC2005=Microsoft Visual C++ 2005 Redistributable X64
10 reg query %HKLMU%{071C9B48-7C32-4621-A0AC-3F809523288F}&gt;nul 2&gt;nul&amp;&amp;set VC2005=Microsoft Visual C++ 2005 SP1 Redistributable X64
11 reg query %HKLMU%{6CE5BAE9-D3CA-4B99-891A-1DC6C118A5FC}&gt;nul 2&gt;nul&amp;&amp;set VC2005=Microsoft Visual C++ 2005 SP1 Redistributable ATL Security Update X64
12 reg query %HKLMU%{03ED71EA-F531-4927-AABD-1C31BCE8E187}&gt;nul 2&gt;nul&amp;&amp;set VC2005=Microsoft Visual C++ 2005 Redistributable IA64
13 reg query %HKLMU%{0F8FB34E-675E-42ED-850B-29D98C2ECE08}&gt;nul 2&gt;nul&amp;&amp;set VC2005=Microsoft Visual C++ 2005 SP1 Redistributable IA64
14 reg query %HKLMU%{85025851-A784-46D8-950D-05CB3CA43A13}&gt;nul 2&gt;nul&amp;&amp;set VC2005=Microsoft Visual C++ 2005 SP1 Redistributable ATL Security Update IA64
15 if defined VC2005 (echo %VC2005% 已安装!&amp;ping -n 3 127.1&gt;nul) else (goto 2005Install)
16 :::::这里你要做的事
17 goto:eof
18 :2005Install
19 :::::这里还可以精确判断何种版本的Visual C++ 2005,该不该更新到最新的。
20 :::::最新的Visual C++ 2008是Microsoft Visual C++ 2005 SP1 Redistributable ATL Security Update ***
21 :::::各版本下载地址 http://www.microsoft.com/downloads/details.aspx?FamilyID=766a6af7-ec73-40ff-b072-9112bab119c2&amp;DisplayLang=zh-cn
22 echo 正在安装 Microsoft Visual C++ 2005 Redistributable
23 vcredist_x86.exe /q
24 goto:eof

VC2008

 1 @echo off
 2 set "HKLMU=HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstall"
 3 ::::: 判断系统是否已经安装了 Visual C++ 2008 (包括所有版本)       bbs.bathome.net By:FastSLZ
 4 ::::: 代码能实现判断X86、X64、IA64各版本的Visual C++ 2008,正确率99%除非微软发布新版本Visual C++ 2008
 5 ::::: 有就跳过安装Visual C++ 2008,没有则先安装。
 6 reg query %HKLMU%{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}&gt;nul 2&gt;nul&amp;&amp;set VC2008=Microsoft Visual C++ 2008 Redistributable X86
 7 reg query %HKLMU%{9A25302D-30C0-39D9-BD6F-21E6EC160475}&gt;nul 2&gt;nul&amp;&amp;set VC2008=Microsoft Visual C++ 2008 SP1 Redistributable X86
 8 reg query %HKLMU%{1F1C2DFC-2D24-3E06-BCB8-725134ADF989}&gt;nul 2&gt;nul&amp;&amp;set VC2008=Microsoft Visual C++ 2008 SP1 Redistributable ATL Security Update X86
 9 reg query %HKLMU%{350AA351-21FA-3270-8B7A-835434E766AD}&gt;nul 2&gt;nul&amp;&amp;set VC2008=Microsoft Visual C++ 2008 Redistributable X64
10 reg query %HKLMU%{8220EEFE-38CD-377E-8595-13398D740ACE}&gt;nul 2&gt;nul&amp;&amp;set VC2008=Microsoft Visual C++ 2008 SP1 Redistributable X64
11 reg query %HKLMU%{4B6C7001-C7D6-3710-913E-5BC23FCE91E6}&gt;nul 2&gt;nul&amp;&amp;set VC2008=Microsoft Visual C++ 2008 SP1 Redistributable ATL Security Update X64
12 reg query %HKLMU%{2B547B43-DB50-3139-9EBE-37D419E0F5FA}&gt;nul 2&gt;nul&amp;&amp;set VC2008=Microsoft Visual C++ 2008 Redistributable IA64
13 reg query %HKLMU%{5827ECE1-AEB0-328E-B813-6FC68622C1F9}&gt;nul 2&gt;nul&amp;&amp;set VC2008=Microsoft Visual C++ 2008 SP1 Redistributable IA64
14 reg query %HKLMU%{977AD349-C2A8-39DD-9273-285C08987C7B}&gt;nul 2&gt;nul&amp;&amp;set VC2008=Microsoft Visual C++ 2008 SP1 Redistributable ATL Security Update IA64
15 if defined VC2008 (echo %VC2008% 已安装!&amp;ping -n 3 127.1&gt;nul) else (goto 2008Install)
16 :::::这里你要做的事
17 goto:eof
18 :2008Install
19 :::::这里还可以精确判断何种版本的Visual C++ 2008,该不该更新到最新的。
20 :::::最新的Visual C++ 2008是Microsoft Visual C++ 2008 SP1 Redistributable ATL Security Update ***
21 :::::各版本下载地址 http://www.microsoft.com/downloads/details.aspx?FamilyID=2051a0c1-c9b5-4b0a-a8f5-770a549fd78c&amp;DisplayLang=zh-cn
22 echo 正在安装 Microsoft Visual C++ 2008 Redistributable
23 vcredist_2008_x86.exe /q
24 goto:eof

转载于:https://www.cnblogs.com/FCoding/archive/2012/07/11/2586877.html

  • 0
    点赞
  • 0
    评论
  • 1
    收藏
  • 扫一扫,分享海报

表情包
插入表情
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
©️2022 CSDN 皮肤主题:编程工作室 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值