LoginSignup
0
0

PowerShellでコマンドプロンプトのwhereをしたいとき

Posted at

PowerShellでコマンドの場所を調べたい

PowerShellでコマンド(実行ファイル)のインストール場所を一覧表示しようと

> where java

とすると何も表示されません。

コマンドプロンプトでは

> where java
C:\Program Files\Eclipse Adoptium\jdk-17.0.8.7-hotspot\bin\java.exe
C:\Program Files\Eclipse Adoptium\jdk-8.0.345.1-hotspot\bin\java.exe

のように表示してくれます。

これをPowerShellでも行うにはどうしたらいいのかを調べてみました。

解決策

gcm 調べたいコマンド -all | select path
とすると一覧表示されます。

> gcm java -all | select path

Path
----
C:\Program Files\Eclipse Adoptium\jdk-17.0.8.7-hotspot\bin\java.exe
C:\Program Files\Eclipse Adoptium\jdk-8.0.345.1-hotspot\bin\java.exe

参考情報

ちなみにエイリアスを使わずパラメータ名も省かずに書くと

> Get-Command -Name java -All | Select-Object -Property Path

となります。

参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0