I assigned XML file contents to a variable $config
and then used another variable $market
to store the output of XPath query:
$config = Get-Content -Path "C:\files\configs\config.xml" -raw
$market = (select-xml -Content $config -xpath /process-config/input/filePattern/marketCode).node.'#text'
Then I add the following line:
write-host this is $market
And the output is this:
PS C:\ps_scripts> .\xmltest.ps1
this is citigroup_ams
#text
-----
citigroup_ams
My desired output would be:
PS C:\ps_scripts> .\xmltest.ps1
this is citigroup_ams
I attempted to add | Out-Null
at the end of the 2nd line but in this case only the output of Write-Host cmdlet was suppressed.
Is there any other way to suppress the output of Select-Xml
?
You're probably looking for something like this :
Output :
this is citigroup_ams