Added install-edit.ps1

This commit is contained in:
Markus Fleschutz 2025-06-25 14:41:06 +02:00
parent d29697c7a1
commit 58a6d84015

29
scripts/install-edit.ps1 Normal file
View File

@ -0,0 +1,29 @@
<#
.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 {
"⏳ Installing Microsoft Edit from Microsoft Store..."
$stopWatch = [system.diagnostics.stopwatch]::startNew()
& 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
}