国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PowerShell > 正文

PowerShell小技巧之同時使用可選強制參數

2020-03-26 19:18:03
字體:
來源:轉載
供稿:網友

在下面腳本函數中讓可選參數和強制參數必須同時使用。

下面演示當可選參數出現,也必須使用這個強制參數。

function Connect-Somewhere{ [CmdletBinding(DefaultParameterSetName='A')] param ( [Parameter(ParameterSetName='A',Mandatory=$false)] [Parameter(ParameterSetName='B',Mandatory=$true)] $ComputerName, [Parameter(ParameterSetName='B',Mandatory=$false)] $Credential ) $chosen = $PSCmdlet.ParameterSetName "You have chosen $chosen parameter set."} # -Computername is optionalConnect-Somewhere# here, -Computername is mandatoryConnect-Somewhere -Credential test

支持所有PS版本

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 郯城县| 迁安市| 乐清市| 礼泉县| 正阳县| 合山市| 南靖县| 大姚县| 杭州市| 霍州市| 东山县| 天津市| 五寨县| 阳曲县| 松江区| 太湖县| 元氏县| 宁化县| 海林市| 托克逊县| 鲜城| 永城市| 凤山市| 运城市| 汝城县| 雅江县| 侯马市| 朝阳区| 安泽县| 内丘县| 吴堡县| 稻城县| 苏州市| 乐亭县| 洛扎县| 宿迁市| 浮梁县| 芜湖县| 广德县| 磴口县| 墨竹工卡县|