Monday, September 30, 2024

Winget Installing Multiple Programs

Using a .bat file

Note the agreements arguement with the windows store app

winget install -e --id=Chocolatey.Chocolatey
winget install -e --id=7zip.7zip
winget install -e --accept-package-agreements --id=9PF4KZ2VN4W9
pause

(the last install is a windows store package)

    Or

winget install --accept-package-agreements Chocolatey.Chocolatey 7zip.7zip 9PF4KZ2VN4W9
pause

Using a .ps1 file

Nice to have all the arguments on one line. All the "" & commas are a pain.

#Install software
$SoftwareToInstall = "MartiCliment.UniGetUI", "7zip.7zip"
foreach ($Software in $SoftwareToInstall) {
    WinGet.exe install $software --silent --force --accept-source-agreements --accept-package-agreements --disable-interactivity --source winget
}

Windows Sandbox makes it difficult to install Winget.

Here is a .ps1 script that works now but things change.

#Install WinGet, used https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget-on-windows-sandbox
Start-Transcript C:\users\wdagutilityaccount\desktop\Installing.txt
$progressPreference = 'silentlyContinue'
Write-Information "Downloading WinGet and its dependencies..."
Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile $env:temp\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile $env:temp\Microsoft.VCLibs.x64.14.00.Desktop.appx
Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile $env:temp\Microsoft.UI.Xaml.2.8.x64.appx
Add-AppxPackage $env:temp\Microsoft.VCLibs.x64.14.00.Desktop.appx
Add-AppxPackage $env:temp\Microsoft.UI.Xaml.2.8.x64.appx
Add-AppxPackage $env:temp\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle

Stop-Transcript
Rename-Item -Path C:\users\wdagutilityaccount\desktop\Installing.txt -NewName C:\users\wdagutilityaccount\desktop\Done.txt 

Hints:
    For bat scripts just copy/paste into notepad and save/name file "anything.bat"
        Double click should run in Windows & Sandbox
    For ps1 scripts just copy/paste into notepad and save/name file "anything.ps1"
        In regular Windows, double clicking the file will run it.
        In Sandbox, right click and "run with Powershell"

Which one do I like for installing multiple probrams?
    I like the bat file's verticle list and ease of editing
    I also like the continuous list. 
    Just remember store apps need additional argument to avoid interaction during install but can be stated once  with continuous list version.
I guess you could go the Full Monty with below or pick and choose as needed.
--silent --force --accept-source-agreements --accept-package-agreements --disable-interactivity --source winget


Magic Wormhole File Transfer With Rymdport

Magic Wormhole File Transfer With Rymdport   Why use Rymdport Magic Wormhole requires Python and is run in the Command Prompt. Rymdport is a...