Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1730723
  • 博文数量: 234
  • 博客积分: 4966
  • 博客等级: 上校
  • 技术积分: 3322
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-13 01:03
文章分类

全部博文(234)

文章存档

2017年(2)

2016年(1)

2015年(8)

2014年(11)

2013年(44)

2012年(27)

2011年(22)

2010年(30)

2009年(37)

2008年(6)

2007年(45)

2006年(1)

分类: WINDOWS

2011-02-19 14:50:59

' *****************************************************************************
' TEST SCRIPT - officesource.vbs
' *****************************************************************************
'  作用: 设置Office源安装路径
'  作者: brinkman
'  日期: 2011.02.15 04.07
'  Copyright (c) sunwill
' *****************************************************************************
 
On Error Resume Next
Const HKEY_CLASSES_ROOT = &H80000000
strComputer = "."
strFilePath = ""  '定义office网络安装路径
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Installer\Products"
oReg.EnumKey HKEY_CLASSES_ROOT, strKeyPath, arrStrings
 
'从注册表strKeyPath键值下查询产品Microsoft Office Professional Edition 2003并定位安装路径
 
For i=0 To UBound(arrStrings)
strValueName = "ProductName"
strkeypath1 = "Installer\Products\" & arrStrings(i)
oReg.GetStringValue HKEY_CLASSES_ROOT, strkeypath1, strValueName, strValue1
If InStr(strValue1, "Microsoft Office Professional Edition 2003") Then
strkeypath2 = strKeyPath1
strOffVer = "Office2003\"
strFullPath = strFilePath
strfile = "PRO11.MSI"
End If
Next
 
'根据不同语言定位安装路径,只包含简体语言

strKeyPath3 = strKeyPath2
strValueName3 = "Language"
oReg.GetDWORDValue HKEY_CLASSES_ROOT,strKeyPath3,strValueName3,dwValue3
If dwValue3 = "2052" Then
 strKeyPath4 = strKeyPath3 & "\" & "SourceList"
 strValueName4 = "LastUsedSource"
 strValue4 = "n;1;" & strFullPath
 oReg.SetExpandedStringValue HKEY_CLASSES_ROOT,strKeyPath4,strValueName4,strValue4
 strKeyPath5 = strKeyPath3 & "\" & "SourceList"
 strValueName5 = "PackageName"
 strValue5 = strfile
 oReg.SetStringValue HKEY_CLASSES_ROOT,strKeyPath5,strValueName5,strValue5
 strKeyPath6 = strKeyPath3 & "\" & "SourceList"  & "\" & "Net"
 strValueName6 = "1"
 strValue6 = strFullPath
 oReg.SetExpandedStringValue HKEY_CLASSES_ROOT,strKeyPath6,strValueName6,strValue6
End If
 
'更改Office 2003默认安装路径,取消本地缓存源

Dim OperationRegistry
Set OperationRegistry=WScript.CreateObject("WScript.Shell")
OperationRegistry.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Delivery\SourceEngine\Downloads\90000804-6000-11D3-8CFE-0150048383C9\Sources\90110804-6000-11D3-8CFE-0150048383C9\Path",strFilePath,"REG_SZ"
OperationRegistry.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\11.0\Delivery\{90110804-6000-11D3-8CFE-0150048383C9}\CDCache","0","REG_SZ"
 
以上脚本为原创,根据使用脚本巧解office安装源问题(修正版) 改编而来
阅读(2997) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2011-03-05 13:43:37

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com