このエントリーをはてなブックマークに追加


コマンドレットのエイリアスを調べる方法

コマンドレットの短縮形であるAliasを調べる方法を以下に記します。


Where-Objectを使用した例

以下の構文で指定したコマンドレットのエイリアスを確認することができます。

Get-Alias | Where-Object { $_.Definition -eq "<コマンドレット名>" }

実行例

PS C:\> Get-Alias | Where-Object { $_.Definition -eq "Get-ChildItem" }

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           dir -> Get-ChildItem
Alias           gci -> Get-ChildItem
Alias           ls -> Get-ChildItem

Select-Stringを使用した例

以下の構文で指定したコマンドレットのエイリアスを確認することができます。

Get-Alias | Out-String -Stream | Select-String <コマンドレット名>

実行例

PS C:\> Get-Alias | Out-String -Stream | Select-String Get-ChildItem

Alias           dir -> Get-ChildItem
Alias           gci -> Get-ChildItem
Alias           ls -> Get-ChildItem

以上、コマンドレットのAliasを調べる方法でした。



トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2015-10-23 (金) 23:03:28