Created
May 11, 2025 00:35
-
-
Save StartAutomating/0d526993d7908eca34fa7f0ad71d25f5 to your computer and use it in GitHub Desktop.
Gist Find Chromium
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Find Chromium | |
if (-not $script:chromium) { | |
# Find the chromium executable or alias, pick the first one | |
$chromium = Get-Command -Name chromium -CommandType Application, Alias -ErrorAction Ignore | | |
Select-Object -First 1 | |
# If we don't have a chromium alias, we'll try to find the chrome or edge executable. | |
if ($chromium) { | |
$script:chromium = $chromium | |
} else { | |
# If there's no running instance of chrome, we'll try to find it. | |
$chromePath = | |
Get-Process chrome, msedge -ErrorAction Ignore | | |
Select-Object -ExpandProperty Path -First 1 | |
if ($chromePath) { | |
$script:chromium = $chromePath | |
} | |
else { | |
Write-Error 'Chromium not found. Please `Set-Alias chromium $ChromiumPath` (after you set $ChromiumPath)' | |
} | |
} | |
} | |
$script:chromium |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment