Skip to content

Instantly share code, notes, and snippets.

@sharl
Last active June 3, 2026 17:42
Show Gist options
  • Select an option

  • Save sharl/693ee400a392c09d36bd02c7b6ed20f4 to your computer and use it in GitHub Desktop.

Select an option

Save sharl/693ee400a392c09d36bd02c7b6ed20f4 to your computer and use it in GitHub Desktop.
microsoft.coreutils と衝突してるかもしれない pwsh エイリアスを削除
$coreutilsBinPath = 'C:\Program Files\coreutils\bin'
if (Test-Path $coreutilsBinPath) {
# 1. bin フォルダ内の .exe ファイル名(拡張子なし)をすべて取得
$coreutilsCmds = Get-ChildItem -Path $coreutilsBinPath -Filter *.exe |
Select-Object -ExpandProperty BaseName
# 2. 全ての PowerShell Alias をループ処理
foreach ($alias in Get-Alias) {
# Alias 名が coreutils のコマンド名と一致するかチェック
if ($coreutilsCmds -contains $alias.Name) {
# 衝突している Alias を強制削除
Remove-Item "Alias:\$($alias.Name)" -Force
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment