<Parameter(ParameterSetName:="InputObject", _ Mandatory:=True, ValueFromPipeline:=True)> _PublicPropertyInputObject()AsProcess()GetReturnmyInputObjectEndGetSet(ByValvalueAsProcess()) myInputObject = valueEndSetEndPropertyPrivatemyInputObject()AsProcess ...
#SYNTAXGet-Help[[-Name]<string>][<CommonParameters>]#OPTIONS-Category<string[]>-Component<string[]>-Functionality<string[]>-Name<string>-Parameter<string>-Path<string>-Role<string[]><CommonParameters> 基础实例: 代码语言:javascript 代码运行次数:0 运行 AI代码解释 #1.例如下面的命令显示 Get-Servic...
Cmdlet 應該定義Name參數或對等專案,讓 Cmdlet 能夠透過某種標識碼修改系統。 此外,Cmdlet 應該定義Force和PassThru參數。 如需這些參數的詳細資訊,請參閱建立可修改系統的 Cmdlet。 定義參數別名 參數別名可以是 Cmdlet 參數的替代名稱或定義完善的 1 個字母或 2 個字母的簡短名稱。 在...
function Test-ValueFromPipelineByPropertyName{ param( [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [string[]]$ComputerName ) Write-Output -InputObject "Saw that ComputerName was '$ComputerName'" } 그런 다음 ComputerName 속성을 사용하여 개체를 파...
public string Parameter1; [Parameter(Mandatory = true, ValueFromPipeline = true)] public string InputObject; protected override void ProcessRecord() { if ( Parameter1 != null ) { WriteObject(Parameter1 + ":" + InputObject); } else { ...
You can also assign aBooleanvalue to a switch when you run the function, as shown in the following example: PowerShell Switch-Item-On:$true Output Switch on PowerShell Switch-Item-On:$false Output Switch off Use splatting to pass parameter values ...
類型: SwitchParameter Position: Named 預設值: None 必要: False 接受管線輸入: False 接受萬用字元: False -DisableCommands 指出此 Cmdlet 會關閉在批處理文件中執行時可能會危害安全性的一些 sqlcmd 功能。 它可防止 Windows PowerShell 變數傳入 Invoke-Sqlcmd 腳本。 SQLCMDINI 文本變數中指定的啟動腳本不會...
PS C:\Users\vol_20120330> get-help get-command-parameter * -ArgumentList<Object[]>获取 cmdlet 或函数在与指定的参数(如path)一起使用时的信息。ArgumentList 的别名为 Args。 要检测在 cmdlet 与特定的提供程序一起使用时添加到 cmdlet 中的参数,请将 ArgumentList 的值设置为提供程序驱动器中的一条路径...
例如,以下命令将 New.Directory 目录从C:\temp目录移动到C:驱动器的根目录。 若要验证该项是否已移动,请包含Move-Itemcmdlet 的 PassThru 参数。 在没有 PassThru 的情况下,Move-Itemcmdlet 不显示任何结果。 PowerShell Move-Item-PathC:\temp\New.Directory-DestinationC:\-PassThru ...
In Windows PowerShell 2.0, it became easier to create custom objects. This is because when I use theNew-Objectcmdlet, I can specify a hash table for the properties. I still useNew-Objectto create a new PSObject, but I now can specify the properties via the–Propertyparameter. I then cre...