powershell - How do I retrieve a HashTable key from a value? -


i have powershell hashtable contains set of key-value pairs (naturally). of hashtable values unique.

i retrieve hashtable key, based on value specify, using powershell.

another options:

  • to iterate on hashtable keys , find key contains value:
    $hashtable.keys |? { $hashtable[$_] -eq $val }
  • to iterate using getenumerator() function:

    $hashtable.getenumerator() | ?{ $_.value -eq $val } | %{ $_.key }


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -