param( [ValidateSet('controller', 'cabinet', 'all')][string]$Mode = 'controller', [string]$Config = "$PSScriptRoot/tools/launch/launcher.ini", [switch]$Check, [switch]$Browser ) $ErrorActionPreference = 'Stop' $launchArguments = @("$PSScriptRoot/tools/launch/launch.py", $Mode, '--config', $Config) if ($Check) { $launchArguments += '--check' } if ($Browser) { $launchArguments += '--browser' } if (Get-Command py -ErrorAction SilentlyContinue) { & py -3 @launchArguments } elseif (Get-Command python -ErrorAction SilentlyContinue) { & python @launchArguments } else { throw 'Python 3 is required. Install it, then reopen PowerShell.' } exit $LASTEXITCODE