mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 05:04:39 +02:00
1.9 KiB
1.9 KiB
Script: install-edit.ps1
This PowerShell script installs Microsoft Edit.
Parameters
PS> ./install-edit.ps1 [<CommonParameters>]
[<CommonParameters>]
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
Example
PS> ./install-edit.ps1
⏳ Installing Microsoft Edit from Microsoft Store...
✅ Microsoft Edit installed successfully (took 25s).
Notes
Author: Markus Fleschutz | License: CC0
Related Links
https://github.com/fleschutz/PowerShell
Script Content
<#
.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 (took 25s).
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
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 (took $($elapsed)s)."
exit 0 # success
} catch {
"⚠️ ERROR: $($Error[0]) in script line $($_.InvocationInfo.ScriptLineNumber)."
exit 1
}
(page generated by convert-ps2md.ps1 as of 08/07/2025 16:01:04)