使用CmdletBinding 属性时,PowerShell 会自动添加通用参数。 不能创建使用与通用参数相同的名称的任何参数。 有关详细信息,请参阅 about_CommonParameters。从PowerShell 3.0 开始,可以使用 @Args 散列传递来表示命令中的参数。 散列传递对于简单和高级函数都有效。 有关更多信息,请参阅 about_Functions 和...
主题about_Functions_Advanced_Parameters 简短说明说明如何向声明了 CmdletBinding 属性的函数添加静态或动态参数。 详细说明您可以在编写函数时声明自己的参数,并且可以使编写的函数能够访问可用于已编译 cmdlet 的通用参数。有关 Windows PowerShell 通用参数的详细信息,请参阅 about_CommonParameters。 静态参数以下示例显示...
about_Parameters 本主題的部分內容可能是機器或 AI 翻譯。 關閉警示 版本 PowerShell 7.4 (LTS) Microsoft.PowerShell.Diagnostics Microsoft.PowerShell.Host Microsoft.PowerShell.Management Microsoft.PowerShell.Security Microsoft.PowerShell.Utility Microsoft.WSMan.Management...
param语句让你能够定义一个或多个参数。 参数定义之间以逗号 (,) 分隔。 有关详细信息,请参阅about_Functions_Advanced_Parameters。 高级函数 在PowerShell 中将函数转化为高级函数非常简单。 函数与高级函数的区别之一是,高级函数具有自动添加的通用参数。 常见参数包括Verbose和Debug等参数。
如需詳細資訊,請參閱 about_Functions_Advanced_Parameters。 MoveNext MoveNext 方法會將枚舉器前進到集合的下一個專案。 會傳回True枚舉器是否已通過集合結尾。 備註 MoveNext 傳回的布爾值會傳送至輸出數據流。您可以透過將輸出類型轉換成 [void] 或將輸出傳送至 Out-Null 來隱藏輸出。 PowerShell 複製 $inpu...
You can also set a custom default value for any parameter of a cmdlet or advanced function. For information about setting custom default values, seeabout_Parameters_Default_Values. Parameter attribute table When you use theFull,Parameter, orOnlineparameters of theGet-Helpcmdlet,Get-Helpdisplays a ...
此设置说明参数的值是否可以包含通配符,使参数值可以与目标容器中的多个现有项目匹配。 通用参数通用参数是指可以用于所有 cmdlet 的参数。有关通用参数的详细信息,请键入: help about_commonparameters 另请参阅about_Command_syntaxabout_Comment_Based_Helpabout_Functions_Advancedabout_Pipelinesabout_Wildcards...
有关详细信息,请参阅 about_Functions_Advanced_Parameters。 MoveNext MoveNext 方法将枚举器前进到集合的下一个元素。 如果枚举器成功前进到下一个元素,则 MoveNext 返回True,如果枚举器已通过集合的末尾,则返回 False。 备注 MoveNext 返回的布尔值将发送到输出流。可以通过类型转换将其转换为 [void] 来禁止输出,...
The common parameters are also available on advanced functions that use the CmdletBinding attribute or the Parameter attribute. When you use these attributes, PowerShell automatically adds the Common Parameters. You can't create any parameters that use the same names as the Common Parameters. Several...
For more information about theparamstatement and the function parameters, seeabout_Functionsandabout_Functions_Advanced_Parameters. Writing help for scripts You can write a help topic for a script by using either of the two following methods: ...