在PowerShell 中,switch 對應至 System.Management.Automation.SwitchParameter。 4.2.6 列舉類型 列舉型別是定義一組具名常數的列舉型別,代表可指派給該列舉型別之物件的所有可能值。 在某些情況下,這組值的特性導致每次只能表示其中一個值。 在其他情況下,一組值是兩個相異的乘冪,而且使用 -bor 運算符 (7.8....
The SwitchParameter type implicitly converts to Boolean. For example: PowerShell Copy if ($MySwitch) { ... } Always base the behavior controlled by the switch on the value of the switch, not the presence of the parameter. There are several ways to test for the presence of...
Type:SwitchParameter Position:Named Default value:None Required:False Accept pipeline input:False Accept wildcard characters:False -JobName 为作业指定一个友好名称。 如果指定此参数,则 cmdlet 将作为作业运行,并且它将返回Job对象。 默认情况下,Windows PowerShell分配名称 JobN,其中 N 是整...
[Parameter(mandatory=$false)] [bool]$AsJob=$false it should be: [Parameter(mandatory=$false)] [switch]$AsJob Check the references for more info.. Reference#1:https://devcentral.f5.com/weblogs/Joe/archive/2009/01/13/powershell-abcs---p-is-for-parameters.aspx Reference#2:https://msgoodie...
[array],[bool],[byte],[char],[datetime],[decimal],[double],[guid],[hashtable],[int16],[int32],[int],[int64],[long],[nullable],[psobject],[regex],[sbyte].[scriptblock],[single],[float],[string],[switch],[timespan],[type],[uint16],[uint32],[uint64],[ XML ] ...
Type: SwitchParameter Position: Named Default value: None Required: False Accept pipeline input: False Accept wildcard characters: False-NameSpecifies a name for the new variable. Expand table Type: String Position: 0 Default value: None Required: True Accept pipeline input: True Accept wildcard...
类型:SwitchParameter 别名:wi Position:Named 默认值:False 必需:False 接受管道输入:False 接受通配符:False 输入 String 可以通过管道将包含 AppendPath、TypeName 或 TypeData 参数的值的字符串传递给此 cmdlet。 输出 None 此cmdlet 不返回任何输出。
忽略编译器警告。 使用此参数可防止Add-Type将编译器警告作为错误进行处理。 类型:SwitchParameter Position:Named 默认值:False 必需:False 接受管道输入:False 接受通配符:False -Language 指定源代码中使用的语言。 此参数的可接受值CSharp。 类型:Language ...
Type: SwitchParameter Aliases: wi Required: False Position: Named Default value: False Accept pipeline input: False Accept wildcard characters: False The WhatIf parameter overrides the value of the $WhatIfPreference variable for the current command. Because the default value of the $WhatIfPreferen...
are just the opposite in that you specify the parameter but the argument is left out. The interpreter assigns the parameter a value based on whether the parameter is present or not. To specify a switch type parameter, you should use the "[switch]" type literal in the parameter declaration....