Skip to content

Instantly share code, notes, and snippets.

@StartAutomating
Created May 11, 2025 00:35
Show Gist options
  • Save StartAutomating/0d526993d7908eca34fa7f0ad71d25f5 to your computer and use it in GitHub Desktop.
Save StartAutomating/0d526993d7908eca34fa7f0ad71d25f5 to your computer and use it in GitHub Desktop.
Gist Find Chromium
#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