where is a direct equivalent:

C:\Users\Joey>where cmd
C:\Windows\System32\cmd.exe
Note that in PowerShell where itself is an alias for Where-Object, thus you need to usewhere.exe in PowerShell.

In cmd you can also use for:

C:\Users\Joey>for %x in (powershell.exe) do @echo %~$PATH:x
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
In PowerShell you have Get-Command and its alias gcm which does the same if you pass an argument (but also works for aliases, cmdlets and functions in PowerShell):

PS C:\Users\Joey> Get-Command where

CommandType Name Definition
----------- ---- ----------
Alias where Where-Object
Application where.exe C:\Windows\system32\where.exe
The first returned command is the one that would be executed.

 

相关文章:

  • 2021-07-22
  • 2021-09-26
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
  • 2021-08-29
  • 2022-12-23
猜你喜欢
  • 2022-02-04
  • 2022-12-23
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案