Jump to content

Reading registry files


Fzz
 Share

Recommended Posts

I did a search for this and then realized...there's not much here. Nice new look though.

I'm trying to do a search and replace on some registry files that I've exported.

When I try to open the files with FileReadLine() it give me junk.

Actually is give me this:ÿþW

If I open the .reg file in notepad and then paste it into a new reg file it works fine. It looks like it's a problem with the file I exported with regedit.

Also, when I open it with NotepadEx it says the format is "DOS / Unicode (UTF16-LE)

If I just type it out from dos...it looks ok.

Any ideas?

Thanks

Fz

Link to comment
Share on other sites

  • 7 months later...

the dos command type is able to read unicode files. just do type unicode.txt > normal.txt and you've got a plain text file.

or just save the regfile from regedit in a different format (regedit offers a few in the save as dialog)

Link to comment
Share on other sites

Hi,

You make a seach under particular keys or whole registry ?

I wrote a script ( inspire from http://www.autoitscript.com/forum/index.php?showtopic=1157& from scriptkitty ), wich look under uninstall reg keys ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" ), export it to a file, then scan the file to search a word, read the key, then delete the key within the registry.

Just because each update of my application create a new key.

Link to comment
Share on other sites

You can convert the unicode to normal text by running it through the "type" console command.... The general syntax is: RunWait("cmd /c type oldFile.reg > newFile.reg")

$original = "C:\Documents and Settings\Administrator\Desktop\RegistryFile.reg"
$new = "C:\Documents and Settings\Administrator\Desktop\new.reg"
RunWait('cmd /c type "' & $original & '" > "' & $new & '"')

$file = FileOpen($new, 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in lines of text until the EOF is reached
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
    MsgBox(0, "Line read:", $line)
Wend

FileClose($file)
Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

I had this issue a while back and Jpm helped me figure it out. It seems exporting it in 9x format makes it readable.

Read Me

Edited by psichosis

We have enough youth. How about a fountain of SMART?

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...