Update open-outlook.ps1 and open-thunderbird.ps1

This commit is contained in:
Markus Fleschutz
2021-12-13 08:55:50 +01:00
parent 1d228e8fb5
commit 506ceb0fd6
2 changed files with 22 additions and 11 deletions

View File

@ -11,5 +11,16 @@
https://github.com/fleschutz/PowerShell
#>
Start-Process "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe"
exit 0 # success
function TryToExec { param($Folder, $Binary)
if (test-path "$Folder/$Binary" -pathType leaf) {
start-process "$Folder/$Binary" -WorkingDirectory "$Folder"
exit 0 # success
}
}
try {
TryToExec "C:\Program Files (x86)\Mozilla Thunderbird" "thunderbird.exe"
throw "It seems Thunderbird isn't installed yet."
} catch {
& "$PSScriptRoot/give-reply.ps1" "Sorry: $($Error[0])"
}