Sign in to follow this  
Followers 0
dexter23

Delete some characters from .reg file

8 posts in this topic

Hi,

I have a big .reg file from which I want to delete all "\" and "," characters.

How can I achieve this?

Share this post


Link to post
Share on other sites



StringReplace()


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Hi.

No clue what you wanna do with the resulting "invalid" REG file, but never mind :)

#include <file.au3>
#include <array.au3>

Dim $RegArr

$RegFile = "c:\temp\dummy.reg"
_FileReadToArray($RegFile, $RegArr)
_ArrayDisplay($RegArr, "Original Array")

For $i = 1 To $RegArr[0]
    $RegArr[$i] = StringReplace($RegArr[$i], "\", "")
    $RegArr[$i] = StringReplace($RegArr[$i], ",", "")
Next

_ArrayDisplay($RegArr, "Array Processing Done")
_FileWriteFromArray($RegFile, $RegArr,1)

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

Open with text editor

Find/Replace "\" with ""

Find/Replace "," with ""

Share this post


Link to post
Share on other sites

Open with text editor

Find/Replace "\" with ""

Find/Replace "," with ""

That's way more work than writing a script if you have more than one file :)


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

That's way more work than writing a script if you have more than one file :)

True but if he has only one file then there is no point writing a script.

I have a big .reg file

:P Edited by LongBowNZ

Share this post


Link to post
Share on other sites

Hi.

No clue what you wanna do with the resulting "invalid" REG file, but never mind :)

#include <file.au3>
#include <array.au3>

Dim $RegArr

$RegFile = "c:\temp\dummy.reg"
_FileReadToArray($RegFile, $RegArr)
_ArrayDisplay($RegArr, "Original Array")

For $i = 1 To $RegArr[0]
    $RegArr[$i] = StringReplace($RegArr[$i], "\", "")
    $RegArr[$i] = StringReplace($RegArr[$i], ",", "")
Next

_ArrayDisplay($RegArr, "Array Processing Done")
_FileWriteFromArray($RegFile, $RegArr,1)oÝ÷ Ù j·lFçbþ«¨µâ0j{m¢·¦¢÷ªºjºZÚ®¢Ý=Ú«¨¶)è­×«¶¬z)Úm«ø¥{­Ê&©ÝDA4áÆ®¶­sb6æ6ÇVFRfÇC¶fÆRæS2fwC°¢6æ6ÇVFRfÇC¶'&æS2fwC° ¤FÒb33cµ&Vt'  ¢b33cµ&VtfÆRÒgV÷C¶3¢b3#·6WGFæw2ç&VrgV÷C°¥ôfÆU&VEFô'&b33cµ&VtfÆRÂb33cµ&Vt'" ¤f÷"b33c¶ÒFòb33cµ&Vt'%³Ð¢b33cµ&Vt'%²b33c¶ÒÒ7G&æu&WÆ6Rb33cµ&Vt'%²b33c¶ÒÂgV÷C²b3#²gV÷C²ÂgV÷C²gV÷C²¢b33cµ&Vt'%²b33c¶ÒÒ7G&æu&WÆ6Rb33cµ&Vt'%²b33c¶ÒÂgV÷C²ÂgV÷C²ÂgV÷C²gV÷C²¤æW@¥ôfÆUw&FTg&öÔ'&b33cµ&VtfÆRÂb33cµ&Vt'"Ã

is enough for me. Thanks!

Share this post


Link to post
Share on other sites

I want to remove "," and "\" in order to use in a batch file with command REG ADD

This <code> is enough for me. Thanks!

You're welcome.

Instead of doing so much changes, try to make use of REGEDIT's silent switch:

regedit.exe /s YourRegFile.REG

You also might want to directly use the registry write capabilities of autoit:

RegWrite()

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
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
Sign in to follow this  
Followers 0