mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-05-10 18:44:50 +02: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
|
https://github.com/fleschutz/PowerShell
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function TryLaunching { param($Path)
|
function TryToExec { param($Folder, $Binary)
|
||||||
if (test-path "$Path" -pathType leaf) {
|
if (test-path "$Folder/$Binary" -pathType leaf) {
|
||||||
start-process "$Path"
|
start-process "$Folder/$Binary" -WorkingDirectory "$Folder"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TryLaunching "C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE"
|
TryToExec "C:\Program Files\Microsoft Office\root\Office16" "OUTLOOK.EXE"
|
||||||
TryLaunching "C:\Programs\Microsoft Office\Office14\OUTLOOK.EXE"
|
TryToExec "C:\Programs\Microsoft Office\Office14" "OUTLOOK.EXE"
|
||||||
exit 0 # success
|
throw "It seems Outlook isn't installed yet."
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
& "$PSScriptRoot/give-reply.ps1" "Sorry: $($Error[0])"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
@ -11,5 +11,16 @@
|
|||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
#>
|
#>
|
||||||
|
|
||||||
Start-Process "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe"
|
function TryToExec { param($Folder, $Binary)
|
||||||
|
if (test-path "$Folder/$Binary" -pathType leaf) {
|
||||||
|
start-process "$Folder/$Binary" -WorkingDirectory "$Folder"
|
||||||
exit 0 # success
|
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