Add open-obs-studio.ps1 and close-obs-studio.ps1

This commit is contained in:
Markus Fleschutz 2021-11-12 12:49:21 +01:00
parent 9c902b4d50
commit ff28c7e297
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,15 @@
<#
.SYNOPSIS
Closes OBS Studio
.DESCRIPTION
This script closes the OBS Studio application gracefully.
.EXAMPLE
PS> ./close-obs-studio
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
taskkill /im obs64.exe
exit 0 # success

View File

@ -0,0 +1,28 @@
<#
.SYNOPSIS
Launches OBS Studio
.DESCRIPTION
This script launches the OBS Studio application.
.EXAMPLE
PS> ./open-obs-studio
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
function TryLaunching { param($Path)
if (test-path "$Path" -pathType leaf) {
start-process "$Path"
exit 0 # success
}
}
try {
TryLaunching "C:\Program Files (x86)\OBS Studio\bin\64bit\obs64.exe"
TryLaunching "C:\Program Files\OBS Studio\bin\64bit\obs64.exe"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}