mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-23 23:29:02 +01:00
Update open-outlook.ps1 and open-thunderbird.ps1
This commit is contained in:
parent
1d228e8fb5
commit
506ceb0fd6
@ -11,18 +11,18 @@
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
function TryLaunching { param($Path)
|
||||
if (test-path "$Path" -pathType leaf) {
|
||||
start-process "$Path"
|
||||
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 {
|
||||
TryLaunching "C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE"
|
||||
TryLaunching "C:\Programs\Microsoft Office\Office14\OUTLOOK.EXE"
|
||||
exit 0 # success
|
||||
TryToExec "C:\Program Files\Microsoft Office\root\Office16" "OUTLOOK.EXE"
|
||||
TryToExec "C:\Programs\Microsoft Office\Office14" "OUTLOOK.EXE"
|
||||
throw "It seems Outlook isn't installed yet."
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry: $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -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])"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user