windows下powershell的包管理工具

时间:2024-09-14 19:35:20

scoop

github 开源地址:https://github.com/lukesampson/scoop

安装命令->powershell管理员模式下输入

Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')

请确认你的powershell版本>5

更简短的安装命令

iwr -useb get.scoop.sh | iex

如果报错可以执行这个命令

Set-ExecutionPolicy RemoteSigned -scope CurrentUser

安装命令记录-->可参考.


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.
'lastupdate' has been set to '2019-11-30T23:51:57.3988239+08:00'
Scoop was installed successfully!
Type 'scoop help' for instructions.
PS C:\Windows\system32> scoop install curl
Installing '7zip' (19.00) [64bit]
7z1900-x64.msi (1.7 MB) [=====================================================================================] 100%
Checking hash of 7z1900-x64.msi ... ok.
Extracting 7z1900-x64.msi ... done.
Linking ~\scoop\apps\7zip\current => ~\scoop\apps\7zip\19.00
Creating shim for '7z'.
Creating shortcut for 7-Zip (7zFM.exe)
'7zip' (19.00) was installed successfully!
Installing 'curl' (7.67.0_4) [64bit]
curl-7.67.0_4-win64-mingw.tar.xz (2.0 MB) [===================================================================] 100%
Checking hash of curl-7.67.0_4-win64-mingw.tar.xz ... ok.
Extracting curl-7.67.0_4-win64-mingw.tar.xz ... done.
Linking ~\scoop\apps\curl\current => ~\scoop\apps\curl\7.67.0_4
Creating shim for 'curl'.
'curl' (7.67.0_4) was installed successfully!
PS C:\Windows\system32>

choco (chocolatey)

官方地址:https://chocolatey.org/install#individual

github项目地址:https://github.com/chocolatey/choco

安装方式

With PowerShell, you must ensure Get-ExecutionPolicy is not Restricted. We suggest using Bypass to bypass the policy to get things installed or AllSigned for quite a bit more security.

Run Get-ExecutionPolicy. If it returns Restricted, then run Set-ExecutionPolicy AllSigned or Set-ExecutionPolicy Bypass -Scope Process.

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))