【发布时间】:2018-12-12 21:29:09
【问题描述】:
我在解析 xml 文件时遇到问题
<DisplayName>Remote_Take_Over_S1_0002</DisplayName>
我正在尝试从"C:\ProgramData\App-V\1BBEDDA5-595E-4CF7-834A-B282C4981469\0C71FE9F-F1C0-47F9-9518-E94898B6424F\AppxManifest.xml"获取以上信息
我知道如何或从哪里开始,但我已经走到了这一步。
$ComputerName = $txb_hostname.Text
$RemoteParentPath = Join-Path -Path "\\$ComputerName" -ChildPath 'c$\ProgramData\App-V'
$RemoteManifestPaths = Get-ChildItem -Path $RemoteParentPath -Recurse -Filter 'AppxManifest.xml' | Select-Object -ExpandProperty FullName
foreach ($manifestFile in $RemoteManifestPaths)
{
$xml = [xml](Get-Content -Path $manifestFile -Raw)
$xml.SelectSingleNode('//*[local-name()="DisplayName"]/text()').Value
LogWrite $xml
}
有什么想法吗?
现在的错误 您不能在空值表达式上调用方法。 在 line:6 char:5
获取内容:找不到路径“H:\AppxManifest.xml”,因为它不存在。 在 line:5 char:18
设法对上述错误进行排序
【问题讨论】:
标签: xml powershell