2
我有一個XML文件中像下面得到一個XML文件的parant節點的直接子節點使用PowerShell
<ParentNode>
<childnode1>
<Name string="Code1"/>
</childnode1>
<childnode2>
<Name string="Code2"/>
</childnode2>
<childnode3>
<Name string="Code3"/>
</childnode3>
</ParentNode>
給我如何使用PowerShell
我試圖打印ParentNode的所有子節點通過使用給定的代碼
foreach($child in $xmlfile.ParentNode)
{
Write-Host $child
}
它應該打印
childnode1
childnode2
childnode3