mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-22 07:53:21 +01:00
Add open-obs-studio.ps1 and close-obs-studio.ps1
This commit is contained in:
parent
9c902b4d50
commit
ff28c7e297
15
Scripts/close-obs-studio.ps1
Normal file
15
Scripts/close-obs-studio.ps1
Normal 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
|
28
Scripts/open-obs-studio.ps1
Normal file
28
Scripts/open-obs-studio.ps1
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user