小编Sub*_*kar的帖子

无法从文件/应用程序打开/读取本地数据

我试图curl使用 PowerShell运行命令。

下面是curl命令

curl --location --request POST "controller/lttrouter/v1/TestResult/process-data-results/" --form "synthesisreport=@"C:\Users\subu\Desktop\testdemo\SynthesisReport.csv";type=text/csv" --form "createdBy=subu" --form "jiraStoryId=LT1235" --form "jiraTaskId=LT1236" --form "tag=demo-test"
Run Code Online (Sandbox Code Playgroud)

以上curl正在处理命令提示符。

我试过下面的 PowerShell 代码

$CurlExecutable = "C:\curl-7.65.1-win64-mingw\bin\curl.exe"
$path="C:\Users\subu\Desktop\Test\SynthesisReport.csv"

Write-Host "CurlFile" $CurlFile
$CurlArguments = '--location','--request', 'POST', 
                 '"controller/lttrouter/v1/TestResult/process-data-results/"',
                 '--form', 'synthesisreport=@$path',
                 '--form', 'createdBy=subu',
                 '--form', 'jiraStoryId=LT1235',
                 '--form', 'jiraTaskId=LT1236',
                 '--form', 'tag=demo-test'

& $CurlExecutable @CurlArguments
Run Code Online (Sandbox Code Playgroud)

我得到以下错误

curl.exe : curl: (26) 无法从文件/应用程序打开/读取本地数据
在行:13 字符:1
+ & $CurlExecutable @CurlArguments
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (curl: (26) Fail...ile/application:String) [], RemoteException
    + FullQualifiedErrorId : NativeCommandError …

powershell post curl http

7
推荐指数
1
解决办法
2万
查看次数

标签 统计

curl ×1

http ×1

post ×1

powershell ×1