Search This Blog

powershell oneliner

Powershell statements can be separated with semicolons:
[xml]$doc = Get-Content "C:\1.xml"; $te = $doc.DocumentElement.SelectSingleNode("token"); if (-not $te) { Write-Host "token element not found" }


To execute a script block using powershell command:
powershell -NoProfile -Command "[xml]$doc = Get-Content C:\1.xml; $te = $doc.DocumentElement.SelectSingleNode(\"token\"); if (-not $te) { Write-Host "token element not found") }"

No comments:

Post a Comment