如何在 PowerShell 中调用重载命令
How to call an overloaded command in PowerShell
我的 PowerShell 环境有两个 Expand-Archive
命令:
- Windows 10 -> 来自 Microsoft.PowerShell.Archive (1.0.1.0)
的函数
- PowerShell 社区扩展 -> 来自 Pscx (3.2.2) 的 CmdLet
我当前的环境默认为来自 Pscx 的 CmdLet:
PS> (Get-Command Expand-Archive).ModuleName
Pscx
是否有从另一个模块调用命令的语法(完全限定名称)?
我不想卸载 Pscx。
您始终可以使用完全限定的模块名称调用函数。
在你的例子中:
Microsoft.PowerShell.Archive\Expand-Archive -Path $Path -Destination $Dest
我认为当你不指定模块时,它使用最后加载的任何东西
我的 PowerShell 环境有两个 Expand-Archive
命令:
- Windows 10 -> 来自 Microsoft.PowerShell.Archive (1.0.1.0) 的函数
- PowerShell 社区扩展 -> 来自 Pscx (3.2.2) 的 CmdLet
我当前的环境默认为来自 Pscx 的 CmdLet:
PS> (Get-Command Expand-Archive).ModuleName
Pscx
是否有从另一个模块调用命令的语法(完全限定名称)?
我不想卸载 Pscx。
您始终可以使用完全限定的模块名称调用函数。
在你的例子中:
Microsoft.PowerShell.Archive\Expand-Archive -Path $Path -Destination $Dest
我认为当你不指定模块时,它使用最后加载的任何东西