none
How to make PowerShell's dot operator "dynamic"?! RRS feed

  • Question

  • Hello,

    I would like to know how to "concatenate" the powershells dot operator.
    Example:
    I have an XML file and I need to check its nodes or tags. So currently I have somthing like:
    $fileOld.$tag1.$tag2.$tag3
    but since I don't know exactly how many tags I have in each file, I would like to be able to go throw all tags with like a for loop. to do that I need a variable that stores the values of $tag1.$tag2.$tag3 dynamically.
    I tried to concatenate these parameters but PS will then see them as strings and points instead of dot operators.
    Could you help me out with this?
    Sorry for bad english and have a nice day!
    Thursday, November 21, 2019 1:32 PM

All replies