Jump to content
sainthuang

How to read the correct folder?

Recommended Posts

sainthuang

; My source below
 Local $sSubKey = ""
   For $i = 1 To 1
   $sSubKey = RegEnumKey("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}", $i)
   If @error Then ExitLoop
      $Var = ("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\" & $sSubkey)
   Next

;....................................................................................................................................................................................................................................

but question is how to identify the folder such the folder will have "0000" and "0001"...with "properties"...I just only want to check last maybe called as "0009" and bypass "Properties"

Could someone help me to show me how to do ? thanks!

 

Share this post


Link to post
Share on other sites
Subz

You could do something like this.

#include <Array.au3>
Local $i = 1, $sRegKey = "HKLM\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}", $sSubKey, $aSubKey[1]
While 1
    $sSubKey = RegEnumKey($sRegKey, $i)
        If @error Then ExitLoop
    If StringLen($sSubKey) = 4 Then _ArrayAdd($aSubKey, $sRegKey & "\" & $sSubKey)
    $i += 1
WEnd
$aSubKey[0] = UBound($aSubKey) - 1
_ArrayDisplay($aSubKey)
MsgBox(48, "Last Reg Key", $aSubKey[$aSubKey[0]])

 

Edited by Subz
  • Like 1

Share this post


Link to post
Share on other sites
sainthuang

hi Subz:

It's very useful for me...thanks for the great help quickly! :) 

BTW, could  I use a variable as called "$Var" to determine it whole string on my specific item not a Array?

 $Var = $aSubKey[$aSubKey[0]]

Thank you very much!

Share this post


Link to post
Share on other sites
Subz

That's correct, I just used the MsgBox as an example on how to get the last key but your code above would work as well.

Cheers

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

×