无法绑定参数,因为多次指定了参数“ D”

时间:2018-12-14 07:43:30

标签: powershell curl

我有这种脚本:

Remove-Item alias:curl
$new_dir = "C:\Users\newUser\Documents\a\b\"
$Script_Name = $MyInvocation.MyCommand.Name
New-Item "${new_dir}" -ItemType Directory
curl -o "${new_dir}test.zip" -d "id=xx&file=2&password=yy" -D "${new_dir}${Script_Name}$(get-date -UFormat "_%Y-%m-%d_%H%M%S").txt" -k https://ent.xyz.se.com/bb/xyx

我的意图是使用选项-D创建一个日志,并将脚本名称和当前日期作为文件名,并将其与zip文件一起保存。

当我单击“使用Powershell运行”时,会显示这种错误:

  

TerminatedError(Invoke-WebRequest):“无法绑定参数,因为多次指定了参数'D'。要为可以接受多个值的参数提供多个值,请使用数组语法。例如,“-parameter value1, value2,value3“。”

该如何解决?

其他问题:

上面的curl脚本可以在Powershell ISE中成功编译,但是不能与“使用Powershell运行”一起使用,两者之间有区别吗?

0 个答案:

没有答案
相关问题