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

首頁 > 開發(fā) > PowerShell > 正文

PowerShell小技巧之同時(shí)使用可選強(qiáng)制參數(shù)

2020-05-30 20:15:09
字體:
供稿:網(wǎng)友

在下面腳本函數(shù)中讓可選參數(shù)和強(qiáng)制參數(shù)必須同時(shí)使用。

下面演示當(dāng)可選參數(shù)出現(xiàn),也必須使用這個(gè)強(qiáng)制參數(shù)。

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版本

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 溧阳市| 黎川县| 定边县| 绥中县| 当阳市| 汕尾市| 南澳县| 甘南县| 郓城县| 礼泉县| 长乐市| 万载县| 陆良县| 兴山县| 班玛县| 远安县| 福海县| 谷城县| 上杭县| 东港市| 饶阳县| 邢台市| 垣曲县| 修水县| 芦山县| 开远市| 土默特右旗| 友谊县| 阆中市| 鹰潭市| 金乡县| 巩义市| 墨竹工卡县| 永泰县| 隆德县| 察雅县| 浮山县| 将乐县| 互助| 杭锦后旗| 镇康县|