Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在windows系统中使用curl命令的困惑 #75

Open
soapgu opened this issue Aug 30, 2021 · 0 comments
Open

在windows系统中使用curl命令的困惑 #75

soapgu opened this issue Aug 30, 2021 · 0 comments
Labels
IDE Good for newcomers problem problem or trouble

Comments

@soapgu
Copy link
Owner

soapgu commented Aug 30, 2021

  • 困惑起因

图片
coding制品库的下载推荐使用curl的方式来拉取,应该这样更方便脚本批处理吧

  • 我通过cmd命令行进去执行,一切正常
    图片

  • 但是我如果从PowerShell进去执行的话
    图片
    直接就报错了

  • 根本原因

PS C:\Users\XXXX\Downloads> Get-Help Invoke-WebRequest                                                                                                                                                                                         名称                                                                                                                        Invoke-WebRequest

语法
    Invoke-WebRequest [-Uri] <uri>  [<CommonParameters>]


别名
    iwr
    wget
    curl


备注
    Get-Help 在此计算机上找不到该 cmdlet 的帮助文件。它仅显示部分帮助。
        -- 若要下载并安装包含此 cmdlet 的模块的帮助文件,请使用 Update-Help。
        -- 若要联机查看此 cmdlet 的帮助主题,请键入: "Get-Help Invoke-WebRequest -Online" 或
           转到 https://go.microsoft.com/fwlink/?LinkID=217035。

就是说curl的Powershell里面被截胡了
图片

  • 解决方案

  • 解决方案1:在PowerShell中做如下修改,curl -> curl.exe,略丑亲测有效

  • 解决方案2:既来之则安之,直接改用Invoke-WebRequest的格式来执行

curl "https://xxxxx-generic.pkg.coding.net/xxxxx/apks/xxxxx-release-1.0.apk?version=28" -Credential "xxxxx@xxxxx.com" -OutFile 28-1.apk
  • 总结

curl已经成为业界共识了,搞不懂微软偏偏为啥一定要自己再搞一套,最多也只能在自己的ps脚本里面玩玩,没有必要花太多精力在这上面,就是写python脚本也比它强啊。
curl语法本身还是值得一学的。

@soapgu soapgu added IDE Good for newcomers problem problem or trouble labels Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IDE Good for newcomers problem problem or trouble
Projects
None yet
Development

No branches or pull requests

1 participant