In this example, multiple aliases are defined for the same parameter. (For more information, seeHow to Declare Cmdlet Parameters.) C# 複製 [Alias("UN","Writer","Editor")] [Parameter()] public string UserName { get { return userName; } set { userName = value; } } private string ...
[-ParameterName <System.String[]>] [-ParameterType <System.Management.Automation.PSTypeName[]>] [-ShowCommandInfo] [-Syntax] [-TotalCount <System.Int32>] [<CommonParameters>] Get-Command [[-ArgumentList] <System.Object[]>] [-All] [-FullyQualifiedModule <Microsoft.PowerShell.Commands.Module...
參數是在函式或腳本區塊的 param() 語句中宣告的變數。 您可以單獨使用選擇性的 [Parameter()] 屬性,或與 [Alias()] 屬性或任何參數驗證屬性搭配使用。參數名稱會遵循變數名稱的規則。 參數名稱是由小數位數、字母字元和底線所組成。 如需命名規則的完整清單,請參閱 about_Variables。重要 可以定義...
functionAliasDemo{param([parameter(Mandatory=$true)][Alias("SN")][string]$ServerName)Write-Output"Our Server name is $ServerName"} Der obige Code erstellt einen Alias für den ParameterServerName. Rufen Sie die FunktionAliasDemoauf und es wird die folgende Ausgabe angezeigt. ...
Get-Help*-ParameterScope 若要查找在特定作用域内可见的变量,请使用Scope的Get-Variable参数。 可见变量包括全局变量、父作用域中的变量和当前作用域中的变量。 例如,以下命令可以获取在本地作用域内可见的变量: PowerShell Get-Variable-ScopeLocal 若要在特定作用域中创建变量,请使用作用域修饰符或的Set-Variable参...
In my example, I create an alias called Filename that applies to the Name parameter, like so:复制 private string _name = "PowerShellIsolatedStore"; /// name of store [Alias("Filename")] [Parameter] public string Name { get { return _name; } set { _name = value; } } Common ...
类型: SwitchParameter Position: Named 默认值: False 必需: False 接受管道输入: False 接受通配符: False-Path指定要搜索的文件的路径。 允许通配符。 默认位置是本地目录。 指定目录中的文件,例如 log1.txt、*.doc或*.*。 如果仅指定目录,命令将失败。 展开表 类型: String[] Position: 1 默认值: Local...
whether a parameter accepts multiple parameter values. When a parameter accepts multiple values, you can type a comma-separated list as the value of the parameter in the command, or save a comma-separated list (an array) in a variable, and then specify the variable as the parameter value. ...
Alias Distinguished name (DN) Canonical DN Domain\Username Email address GUID LegacyExchangeDN SamAccountName User ID or user principal name (UPN) You can't use this parameter with the Owner parameter. Type:SecurityPrincipalIdParameter Position:Named ...
When you import commands into your session from a PowerShell module or from another session, you can use the Prefix parameter of the Import-Module or Import-PSSession cmdlet to add a prefix to the nouns in the names of commands. For example, the following command avoids any conflict with ...