windows中powershell的curl wget——Invoke-WebRequest

windows的curl和wget是假的,实际上是Invoke-WebRequest.exe。
以下是脚本是使用Invoke-WebRequest上传文件到jfrog:

$filePath = ".\file.zip"

$targetFilePath = "file.zip"

$url = "http(s)://<ARTIFACTORY_URL>/<REPO>/<PATH>/$targetFilePath"

$authorization = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("<username>:<token>"))

$headers = @{

"Authorization" = "Basic $authorization"

}

Invoke-WebRequest -Uri $url -Headers $headers -Method PUT -InFile $filePath
posted @ 2024-01-30 16:59  YueQAQ  阅读(114)  评论(0编辑  收藏  举报