我有一些 ps 代码,通过 http 下载 xml 并检查其中的一些 xml
[xml]$stuff = $wc.DownloadString('url')
$xmlvalue = $stuff.SelectSingleNode('xpath')
if ($xmlvalue.'#text' -eq "value")
{
$state = 'OK'
Write-Host 'ok'
}
我所需要的只是能够将该脚本运行为
script.ps1 -url -xpath -operator -value
完全没问题,除了-operator
我不能像 -operator "-eq" 这样使用参数,因为这将是一个错误
有什么办法吗?