Computing.Net > Forums > Programming > Search Registry Key in HKU

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.

Search Registry Key in HKU

Reply to Message Icon

Name: kletho
Date: November 20, 2008 at 06:26:23 Pacific
OS: 2000/XP
CPU/Ram: Centrino/2GB
Product: HB
Comment:

I'd like to delete certain registry keys in HKEY_USERS

Therefore I need to search for a certain key in the batch file. I thought about using REG QUERY HKU\(long number)\Software\PiSA

However I do not know this long number after HKU\
As far as I know I can not use a wildcard instead of this long number. is there another way of finding out if that key exists?

Seaching for a Key in HKLM works perfect because there is no long number(user name information) included
e.g. REG QUERY HKLM\Software\pisa

I don't wanna use regedit or any other tool because i'd love to do it all in a batch file if possible. need to do this on many computers so a script would be fine

looking forward to get any help on how to do this.

thx



Sponsored Link
Ads by Google

Response Number 1
Name: klint
Date: November 20, 2008 at 07:23:15 Pacific
Reply:

You've given me an idea with your question.

Type REG QUERY HKU. See what you get? A list of keys identifying each user on the system. Now all you need to do is combine that with the FOR /F command. Something like:

for /f %%a in ('reg query hku') do (
...
)

but I'm a bit busy right now so I leave it to one of the batch programming experts to fill in the gaps.


0

Response Number 2
Name: Mechanix2Go
Date: November 21, 2008 at 04:47:41 Pacific
Reply:

Good luck, chuck. What I get is:

The specified path is invalid.


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

M2


0

Response Number 3
Name: klint
Date: November 21, 2008 at 12:00:36 Pacific
Reply:

M2, that could be because you're still using Windows Dinosaur Edition (a.k.a. w2k) and it doesn't recognise HKU as a supported abbreviation for HKEY_USERS.


0

Response Number 4
Name: Mechanix2Go
Date: November 21, 2008 at 22:43:54 Pacific
Reply:

could be

====================================
C:\temp\-\x-sim\ft\house>REG QUERY HKEY_USERS
The specified path is invalid.


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

M2


0

Response Number 5
Name: klint
Date: November 23, 2008 at 13:47:17 Pacific
Reply:

Oh I see. In my case I get this:

C:\>REG QUERY HKEY_USERS

! REG.exe VERSION 3.0

HKEY_USERS

HKEY_USERS\.DEFAULT

HKEY_USERS\S-1-5-19

HKEY_USERS\S-1-5-19_Classes

HKEY_USERS\S-1-5-20

HKEY_USERS\S-1-5-20_Classes

HKEY_USERS\S-1-5-21-1292428093-1708537768-1957994488-1006

HKEY_USERS\S-1-5-21-1292428093-1708537768-1957994488-1006_Classes

HKEY_USERS\S-1-5-18


0

Related Posts

See More



Response Number 6
Name: kletho
Date: November 24, 2008 at 04:51:29 Pacific
Reply:

Hello

Sorry for not to reply any sooner. Thanks so far for all your help.

I've tried several things however i have to admit i'm not a batch programer at all. :-)

for a test a used another search string

for /f %%a in ('reg query hku') do (
reg query %%a\software\microsoft\netshow >>nets_log.txt
)

the result as followed:

! REG.exe VERSION 3.0

HKEY_USERS\.DEFAULT\software\microsoft\netshow
HKEY_USERS\.DEFAULT\software\microsoft\netshow\Player

! REG.exe VERSION 3.0

HKEY_USERS\S-1-5-19\software\microsoft\netshow
HKEY_USERS\S-1-5-19\software\microsoft\netshow\Player

! REG.exe VERSION 3.0

HKEY_USERS\S-1-5-20\software\microsoft\netshow
HKEY_USERS\S-1-5-20\software\microsoft\netshow\Player

! REG.exe VERSION 3.0

HKEY_USERS\S-1-5-21-955686789-1011868361-3389687979-19376\software\microsoft\netshow
HKEY_USERS\S-1-5-21-955686789-1011868361-3389687979-19376\software\microsoft\netshow\Player

! REG.exe VERSION 3.0

HKEY_USERS\S-1-5-18\software\microsoft\netshow
HKEY_USERS\S-1-5-18\software\microsoft\netshow\Player

I only need the following first line of each registry entry like:
HKEY_USERS\.DEFAULT\software\microsoft\netshow
HKEY_USERS\S-1-5-19\software\microsoft\netshow
HKEY_USERS\S-1-5-20\software\microsoft\netshow
HKEY_USERS\S-1-5-21-955686789-1011868361-3389687979-19376\software\microsoft\netshow

Yes I could do an additional command like
findstr /e \software\microsoft\netshow nets_log.txt > nets_res.txt

I was wondering if there is another (maybe easier) way of doing so.


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: Search Registry Key in HKU

Enumerating Registry Keys in VB www.computing.net/answers/programming/enumerating-registry-keys-in-vb/1856.html

Batch registry keys www.computing.net/answers/programming/batch-registry-keys/9452.html

Permissions to Registry key batch www.computing.net/answers/programming/permissions-to-registry-key-batch/15179.html