baomaboy
银牌会员
积分 1513
发帖 554
注册 2005-12-30
状态 离线
|
『楼 主』:
卡巴斯基病毒库备份→VBS版
没什么技术含量,只不过看有人找才放上来。
卡巴斯基病毒库备份→VBS版
Quote: | '*****************************************************************************
' FileName: AVP6Bak.VBS
' Author: baomaboy
' Abstract: 用于卡巴斯基病毒库的备份(测试本本为KAV6.0)
'*****************************************************************************
Dim WshSHell,FSO
On Error Resume Next
Set WshSHell = WScript.CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WinVer = WshSHell.Environment("Process")
Set Args = WScript.Arguments
CloseTime = 5
FileName = WScript.ScriptName
FileFullName = WScript.ScriptFullName
FilePath = FSO.GetParentFolderName(FileFullName)
InsPath = FSO.GetSpecialFolder(1)'''0=windows,1=system32,2=user-Temp,
InsFullName = FSO.BuildPath(InsPath ,FileName)
Copyright="玲珑科技"
QQ="QQ:25926183"
Email="Email:25926183@qq.com"
InsTitle="卡巴斯基病毒库备份"
InsAnswer="卡巴斯基病毒库备份"
RegPath1="HKEY_CLASSES_ROOT\Directory\shell\AVP6Bak\"
RegValue1="卡巴斯基毒库备份"
RegForm1="REG_SZ"
RegPath2="HKEY_CLASSES_ROOT\Directory\shell\AVP6Bak\command\"
RegValue2="wscript.exe """& InsFullName &""" ""%L"""
RegForm2="REG_SZ"
RegPath3="HKEY_CLASSES_ROOT\*\shell\AVP6Bak\"
RegPath4="HKEY_CLASSES_ROOT\*\shell\AVP6Bak\command\"
IF FileFullName <> InsFullName then
intAnswer = MsgBox("【是】将“"+ InsAnswer +"”加入到右键菜单,"&Chr(10)&Chr(10)&"【否】将“"+ InsAnswer +"”从右键菜单删除。 ", vbQuestion + vbYesNoCancel, "安装 - "+ InsTitle +" - by baomaboy")
If intAnswer = vbYes Then
WshSHell.RegWrite RegPath1,RegValue1,RegForm1
WshSHell.RegWrite RegPath2,RegValue2,RegForm2
WshSHell.RegWrite RegPath3,RegValue1,RegForm1
WshSHell.RegWrite RegPath4,RegValue2,RegForm2
FSO.GetFile(FileFullName).Copy(InsFullName)
WshSHell.popup _
"添加脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _
"添加注册表项:"+chr(10)+chr(34)+ RegPath3 +chr(34)+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+ _
chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _
, CloseTime, "安装成功 - "+ InsTitle +" - by baomaboy", 0 + 64
end if
If intAnswer = vbNo Then
WshSHell.RegDelete RegPath4
WshSHell.RegDelete RegPath3
WshSHell.RegDelete RegPath2
WshSHell.RegDelete RegPath1
FSO.DeleteFile InsFullName
WshSHell.popup _
"删除脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _
"删除注册表项:"+chr(10)+chr(34)+ RegPath3 +chr(34)+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+ _
chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _
, CloseTime, "卸载成功 - "+ InsTitle +" - by baomaboy", 0 + 64
End If
If intAnswer = vbCancel Then
end if
ELSE
if Args.count="0" then WScript.Quit(0)
AVP6Ku = WshSHell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\KasperskyLab\AVP6\CKAHUM\LastSet\Directory")
AVP6Ins = WshSHell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\KasperskyLab\AVP6\environment\ProductRoot")
if err.number <> 0 then WScript.Quit(0)
AVP6KuName = FSO.GetBaseName(AVP6Ku)
AVP6KuPath = FSO.GetParentFolderName(AVP6Ku)
Package = WScript.Arguments.Item(0)'''取得完全路径
PkgName=FSO.GetBaseName(Package)'''由完全路径取得不带路径和扩展名的名称
PkgPath=FSO.GetParentFolderName(Package)'''由完全路径取得末层文件夹
MyDateStr=split(Date,"-")
MyDate=MyDateStr(0)&"-"&right("0"&MyDateStr(1),2)&"-"&right("0"&MyDateStr(2),2)
BakFolderName="AVP"&MyDate
If (FSO.FolderExists(FSO.BuildPath(PkgPath,BakFolderName))) Then
else
FSO.CreateFolder(FSO.BuildPath(PkgPath ,BakFolderName))
end if
FSO.GetFolder(AVP6Ku).Copy(FSO.BuildPath(PkgPath,BakFolderName&"\"&AVP6KuName))
FSO.GetFolder(FSO.BuildPath(AVP6KuPath,"Data")).Copy(FSO.BuildPath(PkgPath,BakFolderName&"\Data"))
FSO.CopyFolder FSO.BuildPath(AVP6KuPath,"Dskm"),FSO.BuildPath(PkgPath,BakFolderName&"\Dskm")
FSO.GetFile(FSO.BuildPath(AVP6Ins,"Updater2005.ppl")).Copy(FSO.BuildPath(PkgPath,BakFolderName&"\"))
FSO.GetFile(FSO.BuildPath(AVP6Ins,"avpgui.ppl")).Copy(FSO.BuildPath(PkgPath,BakFolderName&"\"))
FSO.GetFile(FSO.BuildPath(AVP6Ins,"BaseInstaller.ppl")).Copy(FSO.BuildPath(PkgPath,BakFolderName&"\"))
FSO.GetFile(FSO.BuildPath(AVP6Ins,"bl.ppl")).Copy(FSO.BuildPath(PkgPath,BakFolderName&"\"))
FSO.GetFile(FSO.BuildPath(AVP6Ins,"ExecInstaller.ppl")).Copy(FSO.BuildPath(PkgPath,BakFolderName&"\"))
FSO.GetFile(FSO.BuildPath(FSO.GetSpecialFolder(1),"Drivers\Klif.sys")).Copy(FSO.BuildPath(PkgPath,BakFolderName&"\"))
WScript.Sleep 1000
RarPath=WshSHell.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WinRAR.exe\Path")
if (FSO.FileExists(FSO.BuildPath(RarPath,"rar.exe"))) then
ExName=".RAR"
CMD = """"&FSO.BuildPath(RarPath,"rar.exe")&""""&" M -ep1 "&BakFolderName&".RAR "&FSO.BuildPath(PkgPath,BakFolderName)
WshSHell.Run CMD,false,true
else
ExName=""
end if
WshShell.popup chr(10) &_
"病毒库成功备份在:"+chr(10)+FSO.BuildPath(PkgPath,BakFolderName)&ExName+chr(10)+chr(10)+ _
"注意:"+chr(10)+"由于卡巴对中文目录的支持不好,所以升级时请不要放在中文目录下。"+chr(10)+chr(10)+ _
chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
chr(10) & "Copyright(C) " + Copyright +" " & QQ &" " + Email _
, CloseTime, "卡巴病毒库备份 - "+ InsTitle +" - by baomaboy", 0 + 64
End IF
Set WshSHell = Nothing
Set FSO = Nothing
Set Args = Nothing
WScript.Quit(0) |
|
[ Last edited by baomaboy on 2008-3-24 at 11:32 PM ]
|
好多菩提树,好多明镜台。本来好多物,好多的尘埃。 |
|