Windows 禁用Powershell中的位置参数绑定
我只想通过别名获取参数: script.ps1-d站点1-c eac34b2d 这是不允许的: script.ps1站点1 eac34b2dWindows 禁用Powershell中的位置参数绑定,windows,powershell,Windows,Powershell,我只想通过别名获取参数: script.ps1-d站点1-c eac34b2d 这是不允许的: script.ps1站点1 eac34b2d 基本上,您希望禁用位置参数绑定。我在Powershell 3.0中介绍了一种内置方式:使用[CmdletBinding(positionbinding=$false)] 此处提供了v2的解决方案: 真不错。正是我需要的。 Param( [parameter(Mandatory=$true)] [alias("d")] $DocRo
基本上,您希望禁用位置参数绑定。我在Powershell 3.0中介绍了一种内置方式:使用
[CmdletBinding(positionbinding=$false)]
此处提供了v2的解决方案:
真不错。正是我需要的。
Param(
[parameter(Mandatory=$true)]
[alias("d")]
$DocRoot,
[alias("c")]
$Commit
)