Files
PowerShell/scripts/install-edit.ps1
2025-06-25 16:27:53 +02:00

35 lines
1.0 KiB
PowerShell

<#
.SYNOPSIS
Installs Edit
.DESCRIPTION
This PowerShell script installs Microsoft Edit.
.EXAMPLE
PS> ./install-edit.ps1
⏳ Installing Microsoft Edit from Microsoft Store...
✅ Microsoft Edit installed successfully in 25s.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
$stopWatch = [system.diagnostics.stopwatch]::startNew()
if ($IsLinux) {
"⏳ Installing Microsoft Edit from Snap Store..."
& sudo snap install msedit
if ($lastExitCode -ne 0) { throw "Can't install Microsoft Edit, is it already installed?" }
} else {
"⏳ Installing Microsoft Edit from Microsoft Store..."
& winget install --id Microsoft.Edit --accept-package-agreements --accept-source-agreements
if ($lastExitCode -ne 0) { throw "Can't install Microsoft Edit, is it already installed?" }
}
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"✅ Microsoft Edit installed successfully in $($elapsed)s."
exit 0 # success
} catch {
"⚠️ ERROR: $($Error[0])"
exit 1
}