Computing.Net > Forums > Programming > Batch file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch file

Reply to Message Icon

Name: kletho
Date: November 19, 2008 at 06:26:03 Pacific
OS: Win 2000/XP
CPU/Ram: Intel Centrino / 2GB
Product: HP
Comment:

Hi Guys

I'm having difficulties on how to solve a Problem regarding the Windows registry.

I would like to filter a list out of the all registry keys who end with "\Pisa]" or "+Partner]"(without quotes)

I have several entries in the registry who look like the example below:

[HKEY_USERS\S-1-5-21-955686789-1011868361-3389687979-20109\Software\PiSA]
.
.
[HKEY_USERS\S-1-5-21-955686789-1011868361-3389687979-19376\Software\Eigner+Partner]
.
.


As a result I'd like to have list (textfile)of ALL keys with the exact ending as described before.

[HKEY_USERS\S-1-5-21-955686789-1011868361-3389687979-20109\Software\PiSA]
[HKEY_USERS\S-1-5-21-955686789-1011868361-3389687979-19376\Software\Eigner+Partner]


I'm not sure on how to do this. I thought about using REG QUERY but then I have to enter the exact registry key. This will not work because the HKEY_USERS keys have different numbers (S-1-5-21-955686789-1011868361-3389687979-20109\ in between)

Do I need to export the registry first and do a search inside?

How could I do this and make a batch not to complicated :-) I appreciate your help and hope you understand what I am looking for.

Thx




Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: November 19, 2008 at 07:42:10 Pacific
Reply:

Do you already have a list of all keys or do you need to create one?


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: kletho
Date: November 19, 2008 at 07:49:08 Pacific
Reply:

Yes I did a registry export to all_reg_keys.reg

however if there is another ways. that's fine too


0

Response Number 3
Name: Mechanix2Go
Date: November 19, 2008 at 08:13:43 Pacific
Reply:

I don't think a .reg file is going to cooperate. It's a bit of an odd format.


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 4
Name: klint
Date: November 19, 2008 at 08:41:01 Pacific
Reply:

If you already have a .reg file, you can search it. Each key is on one line. If all you want is the full key name, just use FIND.

I thought you wanted a way of doing this more quickly than exporting the whole registry to a reg file.


0

Response Number 5
Name: kletho
Date: November 19, 2008 at 09:47:55 Pacific
Reply:

hi klint

what would be a way to do it more quickly. If there is an easier or better way of doing it, i'm open. just don't know how to. :-)

looking forward for any help.
thx


0

Related Posts

See More



Response Number 6
Name: klint
Date: November 19, 2008 at 10:05:40 Pacific
Reply:

I don't think there is a quicker way (but stand to be corrected) because when you do a search inside Regedit, that also takes ages.


0

Response Number 7
Name: kletho
Date: November 20, 2008 at 02:49:52 Pacific
Reply:

all i thought about is not working. exporting a registry can take up to 180 MB (on a terminal server)

I figured out that using the command
findstr /C:"PiSA]" registry.reg > output_pisa.txt is not working

I don't know how to this. I'd love to search only for Registry keys who end with "PiSA]" I expect not to find more than 10 results.

any other solution how to do this?


0

Response Number 8
Name: klint
Date: November 20, 2008 at 06:42:37 Pacific
Reply:

I don't know why (I will try and find out) but for some reason it seems findstr doesn't work with .reg files. Try find instead:

find "PiSA]" registry.reg > output_pisa.txt

Also, you probably only need to export the HKCU tree instead of the whole registry, to save space.


0

Response Number 9
Name: klint
Date: November 20, 2008 at 06:46:34 Pacific
Reply:

Ok, I think I know why. Regedit 5 files are Unicode (UCS-2), and findstr doesn't like that. FIND seems ok with them though. Alternatively, you can export the registry in REGEDIT 4 format, which is "ANSI" (not Unicode). This will work with findstr, and will also be about half the size.


0

Response Number 10
Name: kletho
Date: November 24, 2008 at 22:54:24 Pacific
Reply:

Hi Klint

thanks for all your input and help. I gave up with the findstr command. As you said it has to do with Unicode format. Took me a while to find out :-))

i'm trying to use

For /f %%a IN ('REG QUERY HKU') DO (
.
.
)

The only thing I have to add here are "[-" at the beginning and "]" of each line because I need the string to unregister the key afterward.

hmmm, need to find out how to add characters before and after a string of each line. :-))

thanks Klint


0

Response Number 11
Name: klint
Date: November 25, 2008 at 02:12:14 Pacific
Reply:

Yes, I saw your other thread. Since you're now using reg.exe and this thread is about regedit, it's better to continue with your other thread. In fact, you don't have to bother adding [- and ] because those are only used by regedit (with .reg files) and it's easier, in a batch file, to use the REG DELETE command. Type reg delete /? for full details.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch file

Batch file to count a specific character in a www.computing.net/answers/programming/batch-file-to-count-a-specific-character-in-a/19751.html

FTP batch file www.computing.net/answers/programming/ftp-batch-file/9027.html

batch file www.computing.net/answers/programming/batch-file/13936.html