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

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

PowerShell中對函數(shù)參數(shù)的命名建議

2020-03-26 19:23:14
字體:
供稿:網(wǎng)友

PowerShell自定義函數(shù)的參數(shù)沒有具體的命名規(guī)則,那么怎么做才能讓參數(shù)的命名更加科學(xué)可持續(xù)。

我們應(yīng)該怎么來命名函數(shù)的參數(shù)名稱呢?有沒有一個可供參考的列表?當(dāng)然微軟沒有給出來。但是我們可以來理一個列表出來。微軟自帶了大量的cmdlet,這些cmdlet使用的參數(shù)有什么規(guī)律呢?我們用下面一段命令來統(tǒng)計一下。

 

復(fù)制代碼 代碼如下:

Get-Command -CommandType Cmdlet |
ForEach-Object { $_.Parameters } |
ForEach-Object { $_.Keys } |
Group-Object -NoElement |
Sort-Object Count, Name -Descending |
Select-Object -Skip 11 |
Where-Object { $_.Count -gt 1 }

這段代碼的作用就是把所有的cmdlet使用的參數(shù)名稱來做一個統(tǒng)計,看看哪些名稱的參數(shù)用得比較多,然后按從多到少的順序做一個列表。小編這邊運行后的結(jié)果如下:
復(fù)制代碼 代碼如下:

Count Name
----- ----
   69 Force
   56 InputObject
   53 Credential
   52 Path
   48 PassThru
   43 LiteralPath
   35 UseTransaction
   33 Exclude
   32 Include
   30 ComputerName
   28 Filter
   26 Id
   14 Scope
   14 Property
   14 InstanceId
   13 Value
   13 Authentication
   12 ThrottleLimit
   12 Description
   12 ArgumentList
   10 Session
   10 Encoding
    9 SourceIdentifier
    8 Wait
    8 Namespace
    8 DisplayName
    8 CertificateThumbprint
    8 AsJob
    7 UseSSL
    7 Stream
    7 State
    7 Port
    7 NoClobber
    7 Impersonation
    7 FilePath
    6 TypeName
    6 Timeout
    6 SessionOption
    6 Option
    6 Module
    6 Message
    6 LogName
    6 Job
    6 ConnectionUri
    6 ConfigurationName
    6 Command
    6 Class
    6 ApplicationName
    6 AllowRedirection
    5 View
    5 Variable
    5 Source
    5 Recurse
    5 PSProvider
    5 Delimiter
    4 UseDefaultCredentials
    4 UseCulture
    4 UICulture
    4 StackName
    4 ShowError
    4 NewName
    4 MessageData
    4 Locale
    4 GroupBy
    4 Expand
    4 EnableAllPrivileges
    4 DisplayError
    4 Destination
    4 Depth
    4 Culture
    4 Count
    4 Certificate
    4 Category
    4 CaseSensitive
    4 Body
    4 Authority
    4 Append
    4 Action
    3 Width
    3 Uri
    3 SupportEvent
    3 Server
    3 SecurityDescriptorSddl
    3 ScriptBlock
    3 Restart
    3 PSVersion
    3 ProxyCredential
    3 OutputBufferingMode
    3 NoTypeInformation
    3 NoServiceRestart
    3 Newest
    3 ModulesToImport
    3 MemberType
    3 MaxTriggerCount
    3 MaximumRedirection
    3 LocalCredential
    3 List
    3 Function
    3 Forward
    3 EnableNetworkAccess
    3 CommandType
    3 Cmdlet
    3 Breakpoint
    3 AsString
    3 AssemblyName
    3 As
    2 WebSession
    2 Visibility
    2 Verb
    2 UseSharedProcess
    2 UserAgent
    2 UnjoinDomainCredential
    2 Unique
    2 TypesToProcess
    2 TypeData
    2 Type
    2 TransportOption
    2 TransferEncoding
    2 TotalCount
    2 Title
    2 TimeoutSec
    2 ThreadOptions
    2 ThreadApartmentState
    2 SubscriptionId
    2 Strict
    2 Status
    2 StartupType
    2 StartupScript
    2 SkipNetworkProfileCheck
    2 Skip
    2 ShowSecurityDescriptorUI
    2 SessionVariable
    2 SessionTypeOption
    2 SessionType
    2 SecondValue
    2 Seconds
    2 ScriptsToProcess
    2 Script
    2 RunAsCredential
    2 RestorePoint
    2 Resolve
    2 Quiet
    2 Query
    2 PSSession
    2 PSHost
    2 ProxyUseDefaultCredent...
    2 Proxy
    2 ProcessorArchitecture
    2 PrependPath
    2 Prefix
    2 PowerShellVersion
    2 OutFile
    2 Off
    2 NotMatch
    2 ModuleInfo
    2 Minimum
    2 Method
    2 MemberName
    2 MaximumReceivedObjectS...
    2 MaximumReceivedDataSiz...
    2 Maximum
    2 LiteralName
    2 ListenerOption
    2 Line
    2 JobName
    2 InFile
    2 Index
    2 IdleTimeoutSec
    2 Headers
    2 Header
    2 Guid
    2 FormatTypeName
    2 FormatsToProcess
    2 First
    2 Expression
    2 EventIdentifier
    2 EntryType
    2 End
    2 Drive
    2 DisplayHint
    2 DisableNameChecking
    2 DisableKeepAlive
    2 Delay
    2 Debugger
    2 Date
    2 Copyright
    2 ContentType
    2 ConfigurationTypeName
    2 CompanyName
    2 CommandName
    2 Column
    2 CimSession
    2 CimResourceUri
    2 CimNamespace
    2 CanonicalName
    2 Before
    2 AutoSize
    2 Author
    2 AsCustomObject
    2 ApplicationBase
    2 AppendPath
    2 AllowClobber
    2 All
    2 Alias
    2 After
    2 AccessMode

好了,看到這個列表,我相信大家對如何設(shè)置一個參數(shù)名稱有了一定的了解了。參照這個列表上的名稱,或者就使用這個列表上的名稱,讓你的cmdlet對更易懂!

 

關(guān)于PowerShell函數(shù)的參數(shù)應(yīng)該怎樣命名,本文就介紹這么多,希望對您有所幫助,謝謝!

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 兴业县| 泸溪县| 苍梧县| 肃北| 浮山县| 新乡县| 大庆市| 富川| 丹阳市| 兰州市| 山阳县| 都兰县| 股票| 江孜县| 腾冲县| 南乐县| 永年县| 乐都县| 古田县| 水富县| 黄浦区| 南溪县| 宁明县| 富源县| 洞口县| 瑞丽市| 衡东县| 广东省| 兰考县| 巩义市| 枝江市| 珠海市| 麻城市| 南安市| 旌德县| 清徐县| 池州市| 金阳县| 克什克腾旗| 碌曲县| 长治县|