Jump to content

The best .reg to .au3 Converter


Nafaa
 Share

Recommended Posts

I know that many autoit scripters are looking for .reg to .au3 converter.

Now forget the command: "Regedit.exe /s Reg.reg", just use the converter and enjoy.

This is the script:

#NoTrayIcon
#Include <File.au3>
#include <WindowsConstants.au3>

;By Nafaa


;~ create necessary Dir and key
Global $temp_Dir
Global $temp_reg
Global $name
Global $path
Global $reg1
Global $reg2
Global $AU3
Global $error=0
Global $Key

$temp_Dir=@TempDir & "\Reg_to_Au3"
If FileExists($temp_Dir) Then
if DirRemove($temp_Dir,1)=0 Then $temp_Dir=@TempDir & "\Reg_to_Au3(" & Random(0,1000,1) & ")"
endif
if DirCreate($temp_Dir)=0 Then
    MsgBox(48,"","unable to create necessary files")
    Exit
EndIf

$temp_reg="HKEY_CURRENT_USER\Software\Reg to au3"
If RegDelete($temp_reg)=2 Then $temp_reg="HKEY_CURRENT_USER\Software\Reg to au3(" & Random(0,1000,1) & ")"
if RegWrite($temp_reg)=0 Then
    MsgBox(48,"","unable to create necessary keys")
    Exit
EndIf

;~ starting
$key=""
$reg=FileOpenDialog("Select a reg file",@ScriptDir, "Reg files (*.reg)",1)
$split=StringSplit($reg,"\")
$name=$split[$split[0]]
$path=StringLeft($Reg,StringInStr($Reg,"\", 0,-1)-1)

$Veuillez = GUICreate("Please Wait", 120, 20, -1, -1, $WS_POPUPWINDOW,$WS_EX_TOPMOST)
GUISetState(@SW_SHOW)
$Label1 = GUICtrlCreateLabel("        Please Wait ...", 4, 4, 387, 17)


$n=_FileCountLines($reg)
$reg1=FileOpen($reg,0)
$reg2=FileOpen($temp_Dir & "\" & $name,2)
$newname=StringTrimRight($name,4)
$au3=FileOpen($temp_Dir & "\" & $newname,2)

FileWrite($au3,";Reg Keys or Values to Delete :" & @CRLF)

for $i=1 to $n
$line=FileReadLine($reg1,$i)
$len=StringLen($line)
$num=1
Do
    if StringMid($line,$num,1)="[" Then
        $key=StringTrimLeft($line,$num-1)
        $num=$len
        Do
            $st_mid=StringMid($key,$num,1)
            if $st_mid="]" Then
            $key=StringLeft($key,$num)
            ExitLoop
            EndIf
            $num=$num-1
            if $num<0 Then 
                $key=""
                ExitLoop
            endif
        until 1=2
        if not $key="" then
            Key($key)   
        EndIf
        ExitLoop
    ElseIf StringMid($line,$num,1)='"' Then
        $line=StringTrimLeft($line,$num-1)
        if not $key="" Then
        value1($line,$key)
        endif
        ExitLoop
    ElseIf StringMid($line,$num,1)=' ' Then
        $num=$num+1
    ElseIf StringMid($line,$num,1)='@' Then
        $line=StringTrimLeft($line,$num-1)
        if not $key="" Then
        value2($line,$key)
        endif
        ExitLoop
    Else
        FileWrite($reg2,$line & @CRLF)
        ExitLoop
    endif
    if $num>$len Then ExitLoop
Until 1=2
next

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", "REG_DWORD", "0")
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableRegistryTools", "REG_DWORD", "0")
FileClose($reg1)
FileClose($reg2)
RunWait('regedit.exe /s "' & $temp_Dir & '\' & $name & '"')

FileWrite($au3,@CRLF & "; <HKEY_CLASSES_ROOT> Keys :" & @CRLF)
log_reg($temp_reg & "\HKCR")

FileWrite($au3,@CRLF & "; <HKEY_CURRENT_USER> Keys :" & @CRLF)
log_reg($temp_reg & "\HKCU")

FileWrite($au3,@CRLF & "; <HKEY_LOCAL_MACHINE> Keys :" & @CRLF)
log_reg($temp_reg & "\HKLM")

FileWrite($au3,@CRLF & "; <HKEY_CURRENT_USER> Keys :" & @CRLF)
log_reg($temp_reg & "\HKU")

FileWrite($au3,@CRLF & "; <HKEY_CURRENT_CONFIG> Keys :" & @CRLF)
log_reg($temp_reg & "\HKCC")
GUIDelete($Veuillez)

FileClose($au3)
$save=FileSaveDialog("Choose a location to save auto it file",$path,"auto it (*.au3)","16",$newname & ".au3")
FileCopy($temp_Dir & "\" & StringTrimRight($name,4),$save,1)

DirRemove($temp_Dir,1)
RegDelete($temp_reg)

Func log_reg($key_log)
        $key_=StringReplace($key_log,$temp_reg & "\HKCC","HKEY_CURRENT_CONFIG")
        $key_=StringReplace($key_,$temp_reg & "\HKU","HKEY_USERS")
        $key_=StringReplace($key_,$temp_reg & "\HKLM","HKEY_LOCAL_MACHINE")
        $key_=StringReplace($key_,$temp_reg & "\HKCR","HKEY_CLASSES_ROOT")
        $key_=StringReplace($key_,$temp_reg & "\HKCU","HKEY_CURRENT_USER")
    For $i = 1 to $n*2  ;(for example)
        $val_name = RegEnumVal($key_log,$i)
        if @error <> 0 Then ExitLoop
        $val=RegRead($key_log,$val_name)
        if @extended=1 Then $type="REG_SZ"
        if @extended=2 Then $type="REG_EXPAND_SZ"
        if @extended=3 Then $type="REG_BINARY"
        if @extended=4 Then $type="REG_DWORD"
        if @extended=7 Then $type="REG_MULTI_SZ"
        FileWrite($au3,"RegWrite('" & $key_ & "','" & $val_name & "','" & $type & "','" & $val & "')" & @CRLF)
    next
    For $ii = 1 to $n*2  ;(for example)
        $key_log_New = RegEnumKey($key_log, $ii)
        if @error <> 0 Then 
            ExitLoop
        Else
        log_reg($key_log & "\" & $key_log_New)
        EndIf
    next
EndFunc


Func Key($K_key)

$str_mid=StringMid($K_key,1,2)
if $str_mid="[-" Then
$key=""
$del_key=StringTrimLeft($K_key,2)
$del_key=StringTrimRight($del_key,1)
FileWrite($au3,"RegDelete('" & $del_key &  "')" & @CRLF)
else
$K_key=StringReplace($K_key,"HKEY_CURRENT_USER",$temp_reg & "\HKCU")
$K_key=StringReplace($K_key,"HKEY_CLASSES_ROOT",$temp_reg & "\HKCR")
$K_key=StringReplace($K_key,"HKEY_LOCAL_MACHINE",$temp_reg & "\HKLM")
$K_key=StringReplace($K_key,"HKEY_USERS",$temp_reg & "\HKU")
$K_key=StringReplace($K_key,"HKEY_CURRENT_CONFIG",$temp_reg & "\HKCC")
FileWrite($reg2,$K_key & @CRLF)
endif
EndFunc


func value1($line,$k)
    $error=0
    $replace=StringReplace($line," ","")
    if StringInStr($replace,'"=-')=0 Then
        FileWrite($reg2,$line & @CRLF)
    else
            $k=StringTrimLeft($k,2)
            $k=StringTrimRight($k,1)
            $line=StringTrimLeft($line,1)
            $ln=StringLen($line)
            $nu=$ln
            Do
                $mid=StringMid($line,$nu,1)
                if $mid='"' Then
                    $line=StringLeft($line,$nu-1)
                    ExitLoop
                else
                    $nu=$nu-1
                EndIf
                if $nu<0 Then 
                    $error=1
                    ExitLoop
                EndIf
            Until 1=2
            if Not $error=1 Then FileWrite($au3,'RegDelete("' & $k & '","' & $line & '")' & @CRLF)
    EndIf
EndFunc


Func value2($line,$k)
    $error2=0
    $replace=StringReplace($line," ","")
    if $replace="@=-" Then 
        $k=StringTrimLeft($k,2)
        $k=StringTrimRight($k,1)
        $line=StringTrimLeft($line,1)
        $ln=StringLen($line)
        $nu=$ln
            Do
                $mid=StringMid($line,$nu,1)
                if $mid='"' Then
                    $line=StringLeft($line,$nu-1)
                    ExitLoop
                else
                    $nu=$nu-1
                EndIf
                if $nu<0 Then 
                    $error=1
                    ExitLoop
                EndIf
            Until 1=2
        if Not $error2=1 Then FileWrite($au3,'RegDelete("' & $k & '","")' & @CRLF)
    Else
        FileWrite($reg2,$line & @CRLF)
    EndIf
EndFunc

By Nafaa.

reg to au3.au3

Link to comment
Share on other sites

Why did u put it in here ? Shouldnt it be under Example scripts ?

Seems pretty cool btw ;)

I agree it would be better in example scripts or maybe both. you would get more feedback and some discussion there.

I would like to know what i could use it for! sorry but I dont know much about AutoIt

could I use it to automatically back up the registry?

Link to comment
Share on other sites

Nice script. I modified it a bit to accept CmdLine. I also go through and change directory names with macros (e.g. c:\Program Files becomes @ProgramFilesDir).

automatedfaults this script converts registry files to AutoIT Scripts. I use it in this way for automated program installations.

Edited by Varian
Link to comment
Share on other sites

People, he doesn't have enough posts to post it in Example Scripts yet.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

oh that's a pity, I dont understand that rule. Cant an older member post it on your behalf then!

There are a lot of rules on this forum that are picked up over time, regarding bots, keyloggers, etc. Usually the people who would write the type of programs that shouldn't be posted are identified and removed in relatively short order by their posts in this section. I would guess that the minimum post requirement to post examples is a combination of preventing those users from posting what they're not supposed to AND stopping brand new people who don't know any better from posting in that forum for help.
Link to comment
Share on other sites

Another reason is people who have written one script and think it's the best script ever written so they post it without checking to see what has already been done.

BTW: the word "Best" is usually used in a very opinionated sense and is not generally considered something that should be used in a post title for an example. It might be the best the poster has ever seen but that will be based on limited exposure.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Nice script. I modified it a bit to accept CmdLine. I also go through and change directory names with macros (e.g. c:\Program Files becomes @ProgramFilesDir).

automatedfaults this script converts registry files to AutoIT Scripts. I use it in this way for automated program installations.

@Varian

Can you post your modified script ?

I have an old version and an update will be usefull ! Posted Image

Thanks

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

I can just repeat then - if its not safe for him to post it, if an older member tries the script and decides its "worthy" couldnt he post it (giving credit to the writer) for this guy. The script will be overlooked here and might be handy for people to see.

ps I agree about the "Best" part, he's obviously very proud of his work!

Edited by Hellooopsforgotsendcommand
Link to comment
Share on other sites

And he should well be proud that he has accomplished something as a new member.

If one of the moderators feels it's worthy of being in example scripts then they might move it. The option is for him to wait until his post count is high enough and put a copy of the post in Example Scripts as well.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

@Varian

Can you post your modified script ?

I have an old version and an update will be usefull ! Posted Image

Thanks

The main thing that I added was the last function that replaces common locations with Macros. I haven't fully tested them all..let me know what needs to be changed/added.
#include <File.au3>
#include <WindowsConstants.au3>

;By Nafaa


;~ create necessary Dir and key
Global $Temp_Dir
Global $Temp_reg
Global $Name
Global $Path
Global $Reg1
Global $Reg2
Global $AU3
Global $Error = 0
Global $Key

$Temp_Dir = @TempDir & "\Reg_to_Au3"
If FileExists($Temp_Dir) Then
    If DirRemove($Temp_Dir, 1) = 0 Then $Temp_Dir = @TempDir & "\Reg_to_Au3(" & Random(0, 1000, 1) & ")"
EndIf
If DirCreate($Temp_Dir) = 0 Then
    MsgBox(48, "", "unable to create necessary files")
    Exit
EndIf

$Temp_reg = "HKEY_CURRENT_USER\Software\Reg to au3"
If RegDelete($Temp_reg) = 2 Then $Temp_reg = "HKEY_CURRENT_USER\Software\Reg to au3(" & Random(0, 1000, 1) & ")"
If RegWrite($Temp_reg) = 0 Then
    MsgBox(48, "", "unable to create necessary keys")
    Exit
EndIf

;~ starting
$Key = ''
If $CmdLine[0] = 0 Then
    $Reg = FileOpenDialog("Select a reg file", @ScriptDir, "Reg files (*.reg)", 1)
    If @error Then Exit
Else
    $Reg = $CmdLine[1]
EndIf

$Split = StringSplit($Reg, "\")
$Name = $Split[$Split[0]]
$Path = StringLeft($Reg, StringInStr($Reg, "\", 0, -1) - 1)

$Veuillez = GUICreate("Please Wait", 120, 20, -1, -1, $WS_POPUPWINDOW, $WS_EX_TOPMOST)
GUISetState(@SW_SHOW)
$Label1 = GUICtrlCreateLabel("        Please Wait ...", 4, 4, 387, 17)


$n = _FileCountLines($Reg)
$Reg1 = FileOpen($Reg, 0)
$Reg2 = FileOpen($Temp_Dir & "\" & $Name, 2)
$Newname = StringTrimRight($Name, 4)
$AU3 = FileOpen($Temp_Dir & "\" & $Newname, 2)

FileWrite($AU3, ";Reg Keys or Values to Delete :" & @CRLF)

For $i = 1 To $n
    $Line = FileReadLine($Reg1, $i)
    $Len = StringLen($Line)
    $Num = 1
    Do
        If StringMid($Line, $Num, 1) = "[" Then
            $Key = StringTrimLeft($Line, $Num - 1)
            $Num = $Len
            Do
                $St_mid = StringMid($Key, $Num, 1)
                If $St_mid = "]" Then
                    $Key = StringLeft($Key, $Num)
                    ExitLoop
                EndIf
                $Num = $Num - 1
                If $Num < 0 Then
                    $Key = ""
                    ExitLoop
                EndIf
            Until 1 = 2
            If Not $Key = "" Then
                Key($Key)
            EndIf
            ExitLoop
        ElseIf StringMid($Line, $Num, 1) = '"' Then
            $Line = StringTrimLeft($Line, $Num - 1)
            If Not $Key = "" Then
                value1($Line, $Key)
            EndIf
            ExitLoop
        ElseIf StringMid($Line, $Num, 1) = ' ' Then
            $Num = $Num + 1
        ElseIf StringMid($Line, $Num, 1) = '@' Then
            $Line = StringTrimLeft($Line, $Num - 1)
            If Not $Key = "" Then
                value2($Line, $Key)
            EndIf
            ExitLoop
        Else
            FileWrite($Reg2, $Line & @CRLF)
            ExitLoop
        EndIf
        If $Num > $Len Then ExitLoop
    Until 1 = 2
Next

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", "REG_DWORD", "0")
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableRegistryTools", "REG_DWORD", "0")
FileClose($Reg1)
FileClose($Reg2)
RunWait('regedit.exe /s "' & $Temp_Dir & '\' & $Name & '"')

FileWrite($AU3, @CRLF & "; <HKEY_CLASSES_ROOT> Keys :" & @CRLF)
log_reg($Temp_reg & "\HKCR")

FileWrite($AU3, @CRLF & "; <HKEY_CURRENT_USER> Keys :" & @CRLF)
log_reg($Temp_reg & "\HKCU")

FileWrite($AU3, @CRLF & "; <HKEY_LOCAL_MACHINE> Keys :" & @CRLF)
log_reg($Temp_reg & "\HKLM")

FileWrite($AU3, @CRLF & "; <HKEY_CURRENT_USER> Keys :" & @CRLF)
log_reg($Temp_reg & "\HKU")

FileWrite($AU3, @CRLF & "; <HKEY_CURRENT_CONFIG> Keys :" & @CRLF)
log_reg($Temp_reg & "\HKCC")
GUIDelete($Veuillez)

FileClose($AU3)

Local $Final = FileRead($Temp_Dir & "\" & $Newname)
$Final = RegFixes($Final)
$Save = $Path & '\' & $Newname & '.au3'
FileOpen($Save, 2)
FileWrite($Save, $Final)
FileClose($Save)

DirRemove($Temp_Dir, 1)
RegDelete($Temp_reg)

Func log_reg($Key_log)
    $Key_ = StringReplace($Key_log, $Temp_reg & "\HKCC", "HKEY_CURRENT_CONFIG")
    $Key_ = StringReplace($Key_, $Temp_reg & "\HKU", "HKEY_USERS")
    $Key_ = StringReplace($Key_, $Temp_reg & "\HKLM", "HKEY_LOCAL_MACHINE")
    $Key_ = StringReplace($Key_, $Temp_reg & "\HKCR", "HKEY_CLASSES_ROOT")
    $Key_ = StringReplace($Key_, $Temp_reg & "\HKCU", "HKEY_CURRENT_USER")
    $Key_ = StringReplace($Key_log, $Temp_reg & "\HKCC", "HKCC")
    $Key_ = StringReplace($Key_, $Temp_reg & "\HKU", "HKU")
    $Key_ = StringReplace($Key_, $Temp_reg & "\HKLM", "HKLM")
    $Key_ = StringReplace($Key_, $Temp_reg & "\HKCR", "HKCR")
    $Key_ = StringReplace($Key_, $Temp_reg & "\HKCU", "HKCU")
    For $i = 1 To $n * 2 ;(for example)
        $Val_name = RegEnumVal($Key_log, $i)
        If @error <> 0 Then ExitLoop
        $Val = RegRead($Key_log, $Val_name)
        If @extended = 1 Then $Type = "REG_SZ"
        If @extended = 2 Then $Type = "REG_EXPAND_SZ"
        If @extended = 3 Then $Type = "REG_BINARY"
        If @extended = 4 Then $Type = "REG_DWORD"
        If @extended = 7 Then $Type = "REG_MULTI_SZ"
        FileWrite($AU3, "RegWrite('" & $Key_ & "', '" & $Val_name & "', '" & $Type & "', '" & $Val & "')" & @CRLF)
    Next
    For $Ii = 1 To $n * 2 ;(for example)
        $Key_log_New = RegEnumKey($Key_log, $Ii)
        If @error <> 0 Then
            ExitLoop
        Else
            log_reg($Key_log & "\" & $Key_log_New)
        EndIf
    Next
EndFunc   ;==>log_reg


Func Key($K_key)

    $Str_mid = StringMid($K_key, 1, 2)
    If $Str_mid = "[-" Then
        $Key = ""
        $Del_key = StringTrimLeft($K_key, 2)
        $Del_key = StringTrimRight($Del_key, 1)
        FileWrite($AU3, "RegDelete('" & $Del_key & "')" & @CRLF)
    Else
        $K_key = StringReplace($K_key, "HKEY_CURRENT_USER", $Temp_reg & "\HKCU")
        $K_key = StringReplace($K_key, "HKEY_CLASSES_ROOT", $Temp_reg & "\HKCR")
        $K_key = StringReplace($K_key, "HKEY_LOCAL_MACHINE", $Temp_reg & "\HKLM")
        $K_key = StringReplace($K_key, "HKEY_USERS", $Temp_reg & "\HKU")
        $K_key = StringReplace($K_key, "HKEY_CURRENT_CONFIG", $Temp_reg & "\HKCC")
        FileWrite($Reg2, $K_key & @CRLF)
    EndIf
EndFunc   ;==>Key


Func value1($Line, $k)
    $Error = 0
    $Replace = StringReplace($Line, " ", "")
    If StringInStr($Replace, '" = -') = 0 Then
        FileWrite($Reg2, $Line & @CRLF)
    Else
        $k = StringTrimLeft($k, 2)
        $k = StringTrimRight($k, 1)
        $Line = StringTrimLeft($Line, 1)
        $Ln = StringLen($Line)
        $Nu = $Ln
        Do
            $Mid = StringMid($Line, $Nu, 1)
            If $Mid = '"' Then
                $Line = StringLeft($Line, $Nu - 1)
                ExitLoop
            Else
                $Nu = $Nu - 1
            EndIf
            If $Nu < 0 Then
                $Error = 1
                ExitLoop
            EndIf
        Until 1 = 2
        If Not $Error = 1 Then FileWrite($AU3, 'RegDelete("' & $k & '", "' & $Line & '")' & @CRLF)
    EndIf
EndFunc   ;==>value1


Func value2($Line, $k)
    $Error2 = 0
    $Replace = StringReplace($Line, " ", "")
    If $Replace = "@ = -" Then
        $k = StringTrimLeft($k, 2)
        $k = StringTrimRight($k, 1)
        $Line = StringTrimLeft($Line, 1)
        $Ln = StringLen($Line)
        $Nu = $Ln
        Do
            $Mid = StringMid($Line, $Nu, 1)
            If $Mid = '"' Then
                $Line = StringLeft($Line, $Nu - 1)
                ExitLoop
            Else
                $Nu = $Nu - 1
            EndIf
            If $Nu < 0 Then
                $Error = 1
                ExitLoop
            EndIf
        Until 1 = 2
        If Not $Error2 = 1 Then FileWrite($AU3, 'RegDelete("' & $k & '", "")' & @CRLF)
    Else
        FileWrite($Reg2, $Line & @CRLF)
    EndIf
EndFunc   ;==>value2

Func RegFixes($iString)
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)([a-z]):\\Program Files([ x86\(\)]*)\\Common Files\\', '$1$2' & "' & @CommonFilesDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)([a-z]):\\Program Files([ x86\(\)]*)\\', '$1$2' & "' & @ProgramFilesDir & '\\")

    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)([a-z]):\\Windows\\System32\\', '$1$2' & "' & @SystemDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)([a-z]):\\Windows\\Syswow64\\', '$1$2' & "' & @SystemDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)([a-z]):\\Windows\\', '$1$2' & "' & @WindowsDir & '\\")

    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & @UserProfileDir & "\\AppData\\Local\\Temp\\", '$1$2' & "' & @TempDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & StringRegExpReplace(FileGetShortName(@UserProfileDir & "\AppData\Local\Temp\"), '\\', '\\\\'), '$1$2' & "' & @TempDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & @UserProfileDir & "\\Local Settings\\Temp\\", '$1$2' & "' & @TempDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & StringRegExpReplace(FileGetShortName(@UserProfileDir & "\Local Settings\Temp\"), '\\', '\\\\'), '$1$2' & "' & @TempDir & '\\")

    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & @UserProfileDir & "\\AppData\\Local\\", '$1$2' & "' & @UserProfileDir & '\\Local\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & StringRegExpReplace(FileGetShortName(@UserProfileDir & "\AppData\Local\"), '\\', '\\\\'), '$1$2' & "' & @UserProfileDir & '\\Local\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & @UserProfileDir & "\\Local Settings\\", '$1$2' & "' & @UserProfileDir & '\\Local\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & StringRegExpReplace(FileGetShortName(@UserProfileDir & "\Local Settings\"), '\\', '\\\\'), '$1$2' & "' & @UserProfileDir & '\\Local\\")

    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & @UserProfileDir & "\\AppData\\Roaming\\", '$1$2' & "' & @AppDataDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & StringRegExpReplace(FileGetShortName(@UserProfileDir & "\AppData\Roaming\"), '\\', '\\\\'), '$1$2' & "' & @AppDataDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & @UserProfileDir & "\\Application Data\\", '$1$2' & "' & @AppDataDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & StringRegExpReplace(FileGetShortName(@UserProfileDir & "\Application Data\"), '\\', '\\\\'), '$1$2' & "' & @AppDataDir & '\\")

    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & @UserProfileDir & "\\Desktop\\", '$1$2' & "' & @DesktopDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & StringRegExpReplace(FileGetShortName(@UserProfileDir & "\Desktop\"), '\\', '\\\\'), '$1$2' & "' & @DesktopDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & @UserProfileDir & "\\Desktop\\", '$1$2' & "' & @DesktopDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & StringRegExpReplace(FileGetShortName(@UserProfileDir & "\Desktop\"), '\\', '\\\\'), '$1$2' & "' & @DesktopDir & '\\")

    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)([a-z]):\\Users\\Public\\Desktop\\', '$1$2' & "' & @DesktopCommonDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)([a-z]):\\Documents and Settings\\All Users\\Desktop\\', '$1$2' & "' & @DesktopCommonDir & '\\")

    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & @UserProfileDir & "\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\", '$1$2' & "' & @ProgramsDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & StringRegExpReplace(FileGetShortName(@UserProfileDir & "\AppData\Roaming\Microsoft\\Windows\Start Menu\"), '\\', '\\\\'), '$1$2' & "' & @ProgramsDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & @UserProfileDir & "\\Start Menu\\Programs\\", '$1$2' & "' & @ProgramsDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)' & StringRegExpReplace(FileGetShortName(@UserProfileDir & "\Start Menu\Programs\"), '\\', '\\\\'), '$1$2' & "' & @ProgramsDir & '\\")

    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)([a-z]):\\Users\\Public\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\', '$1$2' & "' & @ProgramsCommonDir & '\\")
    $iString = StringRegExpReplace($iString, "(?i)(')" & '("?)([a-z]):\\Documents and Settings\\All Users\\Start Menu\\Programs\\', '$1$2' & "' & @ProgramsCommonDir & '\\")

    $iString = StringRegExpReplace($iString, "'' & ", '')

    Return $iString
EndFunc   ;==>RegFixes
Link to comment
Share on other sites

  • 3 years later...

I know it is an Old toppic but there is new Portable freeware  ;

Reg Converter v1.0

reg_converter_select_reg_file.png

Reg Converter is a Portable Freeware Utility to convert .reg data to .bat , vbs or Au3 , This is particularly useful for those files which need administrative privileges to be merged into the registry or unattended installations. The interface is very simple

 
1. To convert any .reg file to .bat , vbs or Au3 , use “Select reg File” icon or just Drag and drop the .reg file
2. Choose one of the Output file
3. Use Convert button and Finally Click "save" button to save coverted data
 
If you copy any .reg data and use "Clipboard" button , it will covert it automatically , You can add convert options to your context menu too , to do that use “Menu” Button and click “Context Menu Options” then you can choose desired converter and add it to your Right Click menu ,
 
convert_context.png
 
 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...