Looping thru win 7 registry to find a key's value

Matt Pedigo

In a previuos question, I needed to edit a value in a key in the win 7 registry ( REG ADD - Invalid syntax ). Now I need to loop thru the Profiles to find a specific key where value of a subkey is the string "Network".

The registry looks like this: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\ with these subkeys:

{1C2A5700-E8E8-41C0-9684-6FB69FA73888}

ProfileName REG_SZ SomethingElse

{7AA5E1AE-2408-4B92-9C56-8962CD9E926C}

ProfileName REG_SZ Network

Here is my reg command

reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles" /s /v ProfileName

I want to find the keyname where the subkey "ProfileName" equals "Network". I know I will have to use a FOR loop but I have know idea how to do this.

my final result should return keyname {7AA5E1AE-2408-4B92-9C56-8962CD9E926C}

Any help will be greatly appreciated.

Albert F D

Something like this may help:

@echo off    
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles" /d /f "Network" /s /e
pause

I haven't tested it but by following the details in this, I surmise that it should perform what's required.

EDIT

Extracting the subkey name alone...

@echo off

reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles" /d /f "Network" /s /e > result.txt
for /f "tokens=1*delims=:" %%i in ('findstr /n "^" result.txt') do if %%i equ 2 echo %%~nj
del /q result.txt
pause

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Cannot create registry key value with WiX installer

From Dev

Ruby Win32 Registry: The system cannot find the file specified when looking for registry key that doesn't exist

From Dev

Registry key to find pst locations?

From Dev

ACF - Looping thru posts, then thru flexible content, then thru repeater

From Dev

looping thru Python's os.walk() confusion

From Dev

SQL Server Management Tools Installation fails with registry Wow6432Node key's (default) value

From Dev

Registry value for specific key

From Dev

NSIS - check if registry key value exists

From Dev

VBScript: How to add a HEX value into a registry key?

From Dev

Creating 7 registry values under a registry key without repetition

From Dev

Filtering thru a collection and adding values where key => value pairs match

From Dev

Anaconda prompt closes immediately - the system was unable to find the specified registry key or value

From Dev

How to read value of a registry key c#

From Dev

Populate dropdown value looping thru a set of links

From Dev

Find Windows Registry Key Modify Date

From Dev

Getting Specific Value Of Registry Key in CMD

From Dev

Ruby Win32 Registry: The system cannot find the file specified when looking for registry key that doesn't exist

From Dev

Registry key to find pst locations?

From Dev

ACF - Looping thru posts, then thru flexible content, then thru repeater

From Dev

looping thru multidimentional array and getting value of keys

From Dev

looping thru Python's os.walk() confusion

From Dev

Searching for value in registry sub-key

From Dev

Looping thru XSLT

From Dev

How to extract path from registry key value?

From Dev

Reading registry key value in NSIS fails

From Dev

How to append a registry key value that has spaces in it?

From Dev

Why can't I connect from Ubuntu laptop to a Win7 desktop thru Cisco AnyConnect?

From Dev

Get value from a registry key string

From Dev

Powershell to find registry key and delete it

Related Related

  1. 1

    Cannot create registry key value with WiX installer

  2. 2

    Ruby Win32 Registry: The system cannot find the file specified when looking for registry key that doesn't exist

  3. 3

    Registry key to find pst locations?

  4. 4

    ACF - Looping thru posts, then thru flexible content, then thru repeater

  5. 5

    looping thru Python's os.walk() confusion

  6. 6

    SQL Server Management Tools Installation fails with registry Wow6432Node key's (default) value

  7. 7

    Registry value for specific key

  8. 8

    NSIS - check if registry key value exists

  9. 9

    VBScript: How to add a HEX value into a registry key?

  10. 10

    Creating 7 registry values under a registry key without repetition

  11. 11

    Filtering thru a collection and adding values where key => value pairs match

  12. 12

    Anaconda prompt closes immediately - the system was unable to find the specified registry key or value

  13. 13

    How to read value of a registry key c#

  14. 14

    Populate dropdown value looping thru a set of links

  15. 15

    Find Windows Registry Key Modify Date

  16. 16

    Getting Specific Value Of Registry Key in CMD

  17. 17

    Ruby Win32 Registry: The system cannot find the file specified when looking for registry key that doesn't exist

  18. 18

    Registry key to find pst locations?

  19. 19

    ACF - Looping thru posts, then thru flexible content, then thru repeater

  20. 20

    looping thru multidimentional array and getting value of keys

  21. 21

    looping thru Python's os.walk() confusion

  22. 22

    Searching for value in registry sub-key

  23. 23

    Looping thru XSLT

  24. 24

    How to extract path from registry key value?

  25. 25

    Reading registry key value in NSIS fails

  26. 26

    How to append a registry key value that has spaces in it?

  27. 27

    Why can't I connect from Ubuntu laptop to a Win7 desktop thru Cisco AnyConnect?

  28. 28

    Get value from a registry key string

  29. 29

    Powershell to find registry key and delete it

HotTag

Archive