Scoop already has an export function, but have no import function yet. Here is a simple implementation.
Implementation
Saved to "$env:SCOOP"\apps\scoop\current\libexec\scoop-import.ps1
then you can invoke ‘import’ function via command scoop import
, or just use it as a one-time script.
param(
$exported
)
$apps = (
Get-Content -Path $exported | Select-String '(?<app>.*)\s\(v:(?<version>.*)\)\s\[(?<bucket>.*)\]' -AllMatches |
Foreach-Object {$_.Matches} |
Foreach-Object {($_.Groups["bucket"].Value)+"/"+($_.Groups["app"].Value)}
)
$apps = ($apps | Out-String).Replace("`r`n"," ")
$cmd = "scoop install " + $apps.Trim(" ")
Invoke-Expression $cmd
Usage
> scoop export > exported.list
> cat exported.list
7zip (v:19.00) [main]
...
zulu11 (v:11.48.21) [java]
> scoop import exported.list
// As one-time scirpt:
> scoop-import.ps1 exported.list
Note
- The buckets used need to be added manually
- Apps will be installed as the same manifest from the same bucket, version not included