reg2vbs.vbs 將Reg文件轉(zhuǎn)換為VBS文件保存
來源:易賢網(wǎng) 閱讀:1666 次 日期:2016-07-18 15:49:40
溫馨提示:易賢網(wǎng)小編為您整理了“reg2vbs.vbs 將Reg文件轉(zhuǎn)換為VBS文件保存”,方便廣大網(wǎng)友查閱!

可以將Reg文件轉(zhuǎn)換為VBS文件保存的代碼,網(wǎng)上的好多都有問題,本地特給修正了一下,能幫到大家

代碼如下:

'*****************************************************************************

' FileName: Reg2Vbs.VBS

' Author: baomaboy

' Abstract: 將Reg文件轉(zhuǎn)換為VBS文件保存

'*****************************************************************************

Dim WshShell,FSO

On Error Resume Next

Set WshSHell = WScript.CreateObject("WScript.Shell")

Set FSO = CreateObject("Scripting.FileSystemObject")

Set Args = WScript.Arguments

CloseTime = 5

FileName = WScript.ScriptName

FileFullName = WScript.ScriptFullName

FilePath = FSO.GetParentFolderName(FileFullName)

InsPath = FSO.GetSpecialFolder(1)

InsFullName = FSO.BuildPath(InsPath ,FileName)

Copyright="玲瓏科技"

QQ="QQ:25926183"

Email="Email:[email=25926183@qq.com]25926183@qq.com[/email]"

InsTitle="Reg2Vbs-Txt"

InsAnswer="Reg2Vbs-Txt"

RegPath1="HKEY_CLASSES_ROOT\regfile\shell\RegToVbs\"

RegValue1="REG轉(zhuǎn)VBS腳本文件"

RegForm1="REG_SZ"

RegPath2="HKEY_CLASSES_ROOT\regfile\shell\RegToVbs\command\"

RegValue2="wscript.exe """& InsFullName &""" ""%L"""

RegForm2="REG_SZ"

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

FSO.GetFile(FileFullName).Copy(InsFullName)

WshSHell.popup _

"添加腳本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _

"添加注冊(cè)表項(xiàng):"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+ _

chr(10) & CloseTime & " 秒鐘后本窗口將自動(dòng)關(guān)閉!" +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 RegPath2

WshSHell.RegDelete RegPath1

FSO.DeleteFile InsFullName

WshSHell.popup _

"刪除腳本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _

"刪除注冊(cè)表項(xiàng):"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+ _

chr(10) & CloseTime & " 秒鐘后本窗口將自動(dòng)關(guān)閉!" +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

Set ReadFile = FSO.OpenTextFile(Args(0), 1,false,-1)

ReadAllText = ReadFile.ReadAll

ReadFile.Close

if mid(ReadAllText,1,3) <> "Win" and mid(ReadAllText,1,3) <> "REG" then

Set ReadFile = FSO.OpenTextFile(Args(0), 1)

ReadAllText = ReadFile.ReadAll

ReadFile.Close

end if

For i=1 To Len(ReadAllText)

TempNum = Asc(Mid(ReadAllText,i,1))

if TempNum = 34 Then

TempNum = 18

elseIf TempNum = 13 Then

TempNum = 28

ElseIf TempNum = 10 Then

TempNum = 29

end if

ThisText1 = ThisText1 & chr(TempNum)

Next

Set WriteFile = FSO.OpenTextFile(Args(0)&".VBS",2,True)

WriteFile.WriteLine("On Error Resume Next : Dim WshSHell,FSO,Reg2Vbs:Set WshSHell = WScript.CreateObject(""WScript.Shell""):Set FSO = CreateObject(""Scripting.FileSystemObject""):Reg2Vbs="""& ThisText1 &"""")

WriteFile.WriteLine("Execute(""For i=1 To Len(Reg2Vbs)""&vbCrLf&""TempNum = Asc(Mid(Reg2Vbs,i,1))""&vbCrLf&""If TempNum = 28 Then""&vbCrLf&""TempNum = 13""&vbCrLf&""ElseIf TempNum = 29 Then""&vbCrLf&""TempNum = 10""&vbCrLf&""elseif TempNum=18 Then""&vbCrLf&""TempNum = 34""&vbCrLf&""End If""&vbCrLf&""ThisText2 = ThisText2 & chr(TempNum)""&vbCrLf&""Next"")")

WriteFile.WriteLine("Set RegFile = FSO.OpenTextFile(FSO.BuildPath(FSO.GetSpecialFolder(2),""Temp.reg""),2,True):RegFile.WriteLine(ThisText2):RegFile.Close:WshSHell.Run(""regedit /s ""&FSO.BuildPath(FSO.GetSpecialFolder(2),""Temp.reg"")):WScript.Sleep 500:FSO.DeleteFile FSO.BuildPath(FSO.GetSpecialFolder(2),""Temp.reg"")")

WriteFile.Close

end if

Set WshSHell = Nothing

Set FSO = Nothing

Set Args = Nothing

WScript.Quit(0)

更多信息請(qǐng)查看腳本欄目
易賢網(wǎng)手機(jī)網(wǎng)站地址:reg2vbs.vbs 將Reg文件轉(zhuǎn)換為VBS文件保存
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

2025國考·省考課程試聽報(bào)名

  • 報(bào)班類型
  • 姓名
  • 手機(jī)號(hào)
  • 驗(yàn)證碼
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 加入群交流 | 手機(jī)站點(diǎn) | 投訴建議
工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
云南網(wǎng)警備案專用圖標(biāo)
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
咨詢QQ:526150442(9:00—18:00)版權(quán)所有:易賢網(wǎng)
云南網(wǎng)警報(bào)警專用圖標(biāo)