1. 安装scoop
1、确保允许 Powershell 执行本地脚本:
set-executionpolicy remotesigned -scope currentuser
2、安装scoop:
iwr -useb get.scoop.sh | iex
提示:可能需要科学上网。
2. 取消curl别名
powershell将curl设置成Invoke-WebRequest的别名,所以先要取消别名。
1、如果已有 Powershell 配置文件,请跳过此步骤:
New-Item $profile -force -itemtype file
2、然后编辑$profile文件
notepad $profile
3、向其添加以下行:
remove-item alias:curl
4、使用以下命令保存、关闭记事本并重新加载配置文件,或关闭并打开 Powershell 以应用配置文件
. $profile
3. 删除自带的curl
取消别名之后,运行curl命令之后还会生效,因为C:\Windows\System3下面还有一个curl应用,所以还需要删除这个。
删除的时候需要先授权,再删除。
4. 安装curl
scoop install curl