Public/Start-Spotify.ps1
Function Start-Spotify { <# .Synopsis Starts Spotify .Description Starts Spotify .Example Start-Spotify Starts Spotify .LINK about_functions_advanced .LINK about_CommonParameters #> [CmdletBinding()] Param() $Spotify = "$ENV:APPDATA\Spotify\Spotify.exe" $G19App = "E:\Spotify App\App\Spotify G19 Application.exe" $FileExists = Test-Path $Spotify If ($FileExists -eq "True") { If (!(Get-Process Spotify -ErrorAction SilentlyContinue)) { Write-Verbose "Starting Spotify..." Start-Process $Spotify $FileExists = Test-Path $G19App If ($FileExists -eq "True") { If (!(Get-Process "Spotify G19 Application" -ErrorAction SilentlyContinue)) { Write-Verbose "Starting Spotify G19 App..." Start-Process $G19App } Else { Write-Warning "Spotify G19 App is allready running!" } } Else { Write-Error "Spotify G19 App not found!" } } Else { Write-Verbose "Spotify is allready running!" } } Else { Throw "Spotify not found, exiting..." } } |