Skip to content

Commit 58a6d84

Browse files
author
Markus Fleschutz
committed
Added install-edit.ps1
1 parent d29697c commit 58a6d84

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

scripts/install-edit.ps1

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<#
2+
.SYNOPSIS
3+
Installs Edit
4+
.DESCRIPTION
5+
This PowerShell script installs Microsoft Edit.
6+
.EXAMPLE
7+
PS> ./install-edit.ps1
8+
⏳ Installing Microsoft Edit from Microsoft Store...
9+
✅ Microsoft Edit installed successfully in 25s.
10+
.LINK
11+
https://github.com/fleschutz/PowerShell
12+
.NOTES
13+
Author: Markus Fleschutz | License: CC0
14+
#>
15+
16+
try {
17+
"⏳ Installing Microsoft Edit from Microsoft Store..."
18+
$stopWatch = [system.diagnostics.stopwatch]::startNew()
19+
20+
& winget install --id Microsoft.Edit --accept-package-agreements --accept-source-agreements
21+
if ($lastExitCode -ne 0) { throw "Can't install Microsoft Edit, is it already installed?" }
22+
23+
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
24+
"✅ Microsoft Edit installed successfully in $($elapsed)s."
25+
exit 0 # success
26+
} catch {
27+
"⚠️ ERROR: $($Error[0])"
28+
exit 1
29+
}

0 commit comments

Comments
 (0)