Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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\pisaI 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

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.

Good luck, chuck. What I get is:
The specified path is invalid.
=====================================
If at first you don't succeed, you're about average.M2

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.

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

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

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\PlayerI 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\netshowYes I could do an additional command like
findstr /e \software\microsoft\netshow nets_log.txt > nets_res.txtI was wondering if there is another (maybe easier) way of doing so.

![]() |
![]() |
![]() |

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