简体   繁体   English

如何在 powershell 文件中包含 CURL URL 和变量?

[英]How to include CURL URL with variable in a powershell file?

Below is the curl command which I am running in a powershell file, which is not working as it is not picking the variable $APIToken value:下面是我在 powershell 文件中运行的 curl 命令,它不起作用,因为它没有选择变量 $APIToken 值:

$CurlArgument = "-s",
            "-X", "POST",
            "http://J253:${APIToken}@jenkins-abc.xyzcorp.com/job/Web/job/buildWithParameters?token=Testing_Smoke"
$CURLEXE = "E:\Program Files\Git\mingw64\bin\curl.exe"
& $CURLEXE @CurlArgument

Please suggest how to correctly write the variable.请建议如何正确编写变量。 Thanks谢谢

I will put Lieven Keersmaekers's comment as an answer for all the future visitors:我会将 Lieven Keersmaekers 的评论作为对所有未来访客的回答:

$($APIToken) works, both for curl and for Invoke-Webrequest . $($APIToken)适用于curlInvoke-Webrequest

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM