Last active
June 3, 2026 17:42
-
-
Save sharl/693ee400a392c09d36bd02c7b6ed20f4 to your computer and use it in GitHub Desktop.
microsoft.coreutils と衝突してるかもしれない pwsh エイリアスを削除
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
| $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