Reg2vbs.vbs Convert a reg file to a VBS file Save Script Home modified version _vbs

Source: Internet
Author: User
Tags chr readfile
Copy Code code as follows:

'*****************************************************************************
' FileName:Reg2Vbs.VBS
' Author:baomaboy
' Abstract: Convert a reg file to a VBS file save
'*****************************************************************************
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= "Exquisite Technology"
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 Goto vbs script File"
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 ("" is "+ Insanswer +" "added to the right-click menu," &chr &chr (a) & "No" removes "+ Insanswer +" from the right-click menu. ", vbquestion + vbYesNoCancel," installation-"+ Institle +"-by Baomaboy ")
If intanswer = vbyes Then
WshShell.RegWrite Regpath1,regvalue1,regform1
WshShell.RegWrite Regpath2,regvalue2,regform2
Fso. GetFile (Filefullname). Copy (Insfullname)
Wshshell.popup _
"Add script file:" +CHR (+INSFULLNAME+CHR) +CHR (10) + _
"Add registry key:" +CHR (+CHR) + RegPath1 +CHR (10) + _
CHR & Closetime & "Seconds later this window will automatically close!" +CHR +CHR (10) + _
CHR & "Copyright (C)" + Copyright + "" & QQ & "" + Email _
, Closetime, "Installation Successful-" + Institle + "-by Baomaboy", 0 + 64
End If
If intanswer = vbno Then
Wshshell.regdelete RegPath2
Wshshell.regdelete RegPath1
Fso. DeleteFile Insfullname
Wshshell.popup _
"Delete script file:" +CHR (+INSFULLNAME+CHR) +CHR (10) + _
"Delete registry key:" +CHR (+CHR) + RegPath1 +CHR (+CHR) (10) + _
CHR & Closetime & "Seconds later this window will automatically close!" +CHR +CHR (10) + _
CHR & "Copyright (C)" + Copyright + "" & QQ & "" + Email _
, Closetime, "Uninstall succeeded-" + 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 = Then
Tempnum = 18
ElseIf Tempnum = Then
Tempnum = 28
ElseIf Tempnum = 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 = Then "" &vbCrLf& "" Tempnum = "" &vbCrLf& "" ElseIf tempnum = Then "" & vbcrlf& "" Tempnum = Ten "" &vbCrLf& "" ElseIf tempnum=18 Then "" &vbCrLf& "" Tempnum = "" &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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.