安装 scoop
使用 PowerShell 运行如下命令,在默认目录(C:\Users<user>\scoop)安装 scoop
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
# 或者简写
iwr -useb get.scoop.sh | iex
也可以在运行上面的安装命令之前,先运行如下命令,通过修改 SCOOP 环境变量,将 scoop 安装到自定义目录
$env:SCOOP='D:\Applications\Scoop'
[Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')
# run the installer
还可以通过修改 SCOOP_GLOBAL 环境变量,将 scoop 安装为全局程序到自定义目录
$env:SCOOP_GLOBAL='F:\GlobalScoopApps'
[Environment]::SetEnvironmentVariable('SCOOP_GLOBAL', $env:SCOOP_GLOBAL, 'Machine')
# run the installer
安装时报错如下
使用“1”个参数调用“DownloadString”时发生异常:“未能解析此远程名称: 'raw.githubusercontent.com'”
所在位置 行:1 字符: 1
+ Invoke-Expression (New-Object System.Net.WebClient).DownloadString('h ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
处理方法
通过浏览器访问 https://get.scoop.sh,会自动跳转到 https://raw.githubusercontent.com/lukesampson/scoop/master/bin/install.ps1,而该跳转地址在本地无法访问
运行 ping 命令
ping raw.githubusercontent.com
Ping 请求找不到主机 raw.githubusercontent.com。请检查该名称,然后重试。
可以看到 DNS 无法解析域名,于是直接修改本地的 hosts 文件
151.101.108.133 raw.githubusercontent.com
再次运行 scoop 安装命令,则安装安装
PS C:\WINDOWS\system32> Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
Initializing...
Downloading scoop...
Extracting...
Creating shim...
Downloading main bucket...
Extracting...
Adding ~\scoop\shims to your path.