gpt4 book ai didi

powershell - 在 PowerShell 中执行 `where.exe`

转载 作者:行者123 更新时间:2023-12-03 00:28:07 25 4
gpt4 key购买 nike

我想在 PowerShell 中使用与 where.exe 相同的功能给我。

我试图找到一个 cmdlet 替代标准的可执行文件,但找不到任何东西。

所以默认情况下,我尝试在 PowerShell 中执行 where 命令,但有一个别名映射到该命令。

PS C:\> Get-Command whereCommandType     Name                                           Version    Source-----------     ----                                           -------    ------Alias           where -> Where-Object

有没有一种方法可以在 PowerShell 中执行 where 或者有没有更好的方法来达到相同的结果?

最佳答案

当然,如果您不想删除指向Where-Objectwhere 别名,您可以键入.exe (输入 . 后跟 TAB 键就足够了),如:

where.exe notepad

否则,您是否尝试过使用 -All 参数(PowerShell 3 及更高版本)的 Get-Command(别名 gcm)?例如:

gcm notepad -All

在我的机器上,给出:

CommandType     Name                                               Version    Source-----------     ----                                               -------    ------Application     notepad.exe                                        10.0.10... C:\Windows\system32\notepad.exeApplication     notepad.exe                                        10.0.10... C:\Windows\notepad.exe

它也会找到 PowerShell 的东西,如示例 gcm where -All 中给出的:

CommandType     Name                                               Version    Source-----------     ----                                               -------    ------Alias           where -> Where-ObjectApplication     where.exe                                          10.0.10... C:\Windows\system32\where.exe

如果您确实想要删除“标准”别名,请使用Remove-Item alias:where(如果您希望在每次启动 PowerShell)。

关于powershell - 在 PowerShell 中执行 `where.exe`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46642416/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com