小编ver*_*edr的帖子

Powershell 7:在字符串文字中使用与号 (&)

我正在尝试在 PowerShell 中执行以下命令,但我不知道如何转义作为 URL 一部分的 & 符号

  az rest `
    --method GET `
    --uri ("https://graph.microsoft.com/v1.0/groups?`$count=true&`$filter=startsWith(displayName,'some+filter+text')&`$select=id,displayName") `
    --headers 'Content-Type=application/json'
Run Code Online (Sandbox Code Playgroud)

由于 & 字符用于启动新命令,因此它会破坏 url 并希望执行其余部分。

有没有办法告诉 powershell 不要这样做?

powershell

6
推荐指数
1
解决办法
3076
查看次数

标签 统计

powershell ×1