2017-06-20 67 views
2

我在unix中執行卷曲工作正常。窗口中的相同捲曲失敗。捲曲的窗戶失敗

UNIX

curl -k --user admin:f1f82c270ec3ce28b4279809900fa00b -H "Jenkins-Crumb:3e7dc5a087ef7697f4a31d74fb99c4ac" -X POST https://jenkins-xyz/buildWithParameters?token=test\&release_version=2.1.0 

Windows PowerShell中的同樣的事情出現了錯誤有以下

PS D:\Softwares\curl> curl.exe -k --user admin:f1f82c270ec3ce28b4279809900fa00b -H "Jenkins-Crumb:3e7dc5a087ef7697f4a31d 
74fb99c4ac" -X POST https://jenkins-xyz/buildWithParameters?token=test\&release_version=2.1.0 
At line:1 char:226 
+ ... ers?token=test\&release_version=2.1.0 
+     ~ 
The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double 
quotation marks ("&") to pass it as part of a string. 
    + CategoryInfo   : ParserError: (:) [], ParentContainsErrorRecordException 
    + FullyQualifiedErrorId : AmpersandNotAllowed 

回答

0

你需要引用你的論點或使用PowerShell的命令行中使用的命令操作(&)。它將您的&符解釋爲命令操作符。

& .\curl.exe -k --user admin:f1f82c270ec3ce28b4279809900fa00b -H "Jenkins-Crumb:3e7dc5a087ef7697f4a31d74fb99c4ac" -X POST https://jenkins-xyz/buildWithParameters?token=test\&release_version=2.1.0 

powershell-and-external-commands-done-right