如何在PowerShell中读取XML文件中的元素? [英] How to read an element in XML file in powershell?
本文介绍了如何在PowerShell中读取XML文件中的元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I have an XML file looks like this :
<?xml version="1.0" encoding="UTF-8"?>
<INITIAL>
<FB1> fr <FB1>
<FB2> fs <FB2>
<FB3> ft <FB3>
<FB4> fu <FB4>
<FB5> fv <FB5>
<FB6> fw <FB6>
<FB7> fh <FB7>
<FB8> gK <FB8>
<FB9> fg <FB9>
</INITIAL>
I just want to read element FB1 tp FB9 and convert it to string, be like this :
frfsftfufvfwfhgKfg
我尝试过的:
What I have tried:
$XML = Get-Content "C:\Users\initial.xml"
$XML
推荐答案
XML = Get-ContentC:\ Users \ initit.xml
XML = Get-Content "C:\Users\initial.xml"
XML
请参阅 Select-Xml [ ^ ]。
这篇关于如何在PowerShell中读取XML文件中的元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文