【发布时间】:2018-06-27 21:40:02
【问题描述】:
用于在 PowerShell cmdlet 中声明别名的 documentation 显示如下:
Function Get-SomeValue {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true,Position=0)]
[Alias("MachineName")]
[string[]]$ComputerName
)
Get-WmiObject -Class Win32_ComputerSystem -ComputerName $ComputerName
}
我使用什么语法来创建多个别名?
[Alias("one","two","three)][Alias("one")][Alias("two")][Alias("three")]- 以上都不是
- 还有别的吗?
附:使用Get-Help 时,应该在哪里显示别名?到目前为止,我还没有看到它们。
【问题讨论】:
标签: powershell syntax alias