欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

Windows 安装 Scoop

程序员文章站 2022-04-04 12:32:16
Scoop介绍 scoop是Windows下的包管理工具 安装环境要求 1,操作环境:win10 2,确保你的 PowerShell 版本 >= 3. win7或许低于3,得升级。如何确认PowerShell,在powershell 命令窗口输入 3,确保你允许PowerShell执行本地脚本,在P ......

scoop介绍

  scoop是windows下的包管理工具

安装环境要求

   1,操作环境:win10

        2,确保你的 powershell 版本 >= 3. win7或许低于3,得升级。如何确认powershell,在powershell 命令窗口输入

$psversiontable.psversion

  3,确保你允许powershell执行本地脚本,在powershell中输入如下内容后,选择yes或则a

set-executionpolicy remotesigned -scope currentuser

安装scoop

在powershell中输入如下内容(默认安装目录c:\users\user(自己的用户名)\scoop):

iex (new-object net.webclient).downloadstring('https://get.scoop.sh')

想要指定安装目录,在powershell中输入如下内容(代码中的c:\scoop为指定的目录):

[environment]::setenvironmentvariable('scoop','c:\scoop','user')
$env:scoop='c:\scoop'
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')

等待安装完成。

scoop安装完成后

输入以下命令查看scoop命令的概述:

scoop help

结果显示如下:

 1 ps c:\users\alex.k.wang> scoop help
 2 usage: scoop <command> [<args>]
 3 
 4 some useful commands are:
 5 
 6 alias       manage scoop aliases
 7 bucket      manage scoop buckets
 8 cache       show or clear the download cache
 9 checkup     check for potential problems
10 cleanup     cleanup apps by removing old versions
11 config      get or set configuration values
12 create      create a custom app manifest
13 depends     list dependencies for an app
14 export      exports (an importable) list of installed apps
15 help        show help for a command
16 home        opens the app homepage
17 info        display information about an app
18 install     install apps
19 list        list installed apps
20 prefix      returns the path to the specified app
21 reset       reset an app to resolve conflicts
22 search      search available apps
23 status      show status and check for new app versions
24 uninstall   uninstall an app
25 update      update apps, or scoop itself
26 virustotal  look for app's hash on virustotal.com
27 which       locate a shim/executable (similar to 'which' on linux)
28 
29 
30 type 'scoop help <command>' to get help for a specific command.
 

输入'scoop help <command>'可以查看具体的某个命令的用法,如下所示:

scoop help install

显示结果如下:

Windows 安装 Scoop
 1 ps c:\users\alex.k.wang> scoop help install
 2 usage: scoop install <app> [options]
 3 
 4 e.g. the usual way to install an app (uses your local 'buckets'):
 5      scoop install git
 6 
 7 to install an app from a manifest at a url:
 8      scoop install https://raw.github.com/lukesampson/scoop/master/bucket/runat.json
 9 
10 to install an app from a manifest on your computer
11      scoop install \path\to\app.json
12 
13 when installing from your computer, you can leave the .json extension off if you like.
14 
15 options:
16   -g, --global              install the app globally
17   -i, --independent         don't install dependencies automatically
18   -k, --no-cache            don't use the download cache
19   -s, --skip                skip hash validation (use with caution!)
20   -a, --arch <32bit|64bit>  use the specified architecture, if the app supports it
Windows 安装 Scoop

查找要安装的程序,如gradle:

scoop search gradle

显示结果如下:

1 ps c:\users\alex.k.wang> scoop search gradle
2 'main' bucket:
3     gradle-bin (5.1.1)
4     gradle (5.1.1)

查找所有可用程序:

scoop search

 

安装程序,如gradle,默认会安装到scoop安装目录下的apps目录:

scoop install gradle

显示结果如下:

1 ps c:\users\alex.k.wang> scoop install gradle
2 installing 'gradle' (5.1.1) [32bit]
3 gradle-5.1.1-all.zip (124.7 mb) [>                                                        ]   1%

也可将程序安装到指定目录,如f:\globalscoopapps:

[environment]::setenvironmentvariable('scoop_global','c:\globalscoopapps','machine')
$env:scoop_global='c:\globalscoopapps'
scoop install -g <app>

对scoop进行版本更新:

scoop update

对scoop安装的所有程序进行更新(也可指定某个程序进行更新):

scoop update *