Fix open-obs-studio.ps1

This commit is contained in:
Markus Fleschutz 2021-12-03 13:07:13 +01:00
parent 1896543ea5
commit 1d5c57c758

View File

@ -11,16 +11,16 @@
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
#> #>
function TryLaunching { param($Path) function TryLaunching { param([string]$Path, [string]$Dir)
if (test-path "$Path" -pathType leaf) { if (test-path "$Path" -pathType leaf) {
start-process "$Path" start-process -FilePath "$Path" -WorkingDirectory "$Dir"
exit 0 # success exit 0 # success
} }
} }
try { try {
TryLaunching "C:\Program Files (x86)\OBS Studio\bin\64bit\obs64.exe" TryLaunching "C:\Program Files (x86)\OBS Studio\bin\64bit\obs64.exe" "C:\Program Files (x86)\OBS Studio\bin\64bit\"
TryLaunching "C:\Program Files\OBS Studio\bin\64bit\obs64.exe" TryLaunching "C:\Program Files\OBS Studio\bin\64bit\obs64.exe" "C:\Program Files\OBS Studio\bin\64bit\"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"