在bash中的`which`的cmd/powershell相当于什么?

我想找出CMD shell使用哪个版本的可执行文件。在任何unix shell中,我会用它来找到它。

在其中一个Windows shell中是否有等效的命令?

各种。

>哪里是直接的等价物?

C:\Users\Joey>where cmd
C:\Windows\System32\cmd.exe

请注意,在PowerShell中,它本身是Where-Object的别名,因此您需要在PowerShell中使用where.exe。
>在cmd中,您还可以使用:

C:\Users\Joey>for %x in (powershell.exe) do @echo %~$PATH:x
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

>在PowerShell中,您有Get-Command及其别名gcm,如果传递参数(但也可用于PowerShell中的别名,cmdlet和函数),则执行相同操作:

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

CommandType     Name          DeFinition
-----------     ----          ----------
Alias           where         Where-Object
Application     where.exe     C:\Windows\system32\where.exe

一个返回的命令是将被执行的命令。

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...