我想填充我在$ PROFILE中創建的Powershell函數的Description屬性。我想爲Description屬性添加一個值,例如「Created in personal PROFILE」。這可能嗎?如何將值添加到PowerShell功能的描述屬性?
目前,如果我檢查我的職務,我覺得沒有被填充的說明,例如:
Get-Command -Type Function -Name get-* | Select-Object -Property Name, Description -First 10
Name Description
---- -----------
Get-AlertLog
Get-AllColors
Get-AppBackgroundTask
Get-AppvVirtualProcess
Get-AppxLastError
Get-AppxLog
Get-AssignedAccess
Get-AutologgerConfig
Get-BCClientConfiguration
Get-BCContentServerConfiguration
有填充,讓我來搜索和快速查看值,其中創建我的功能,或者是什麼他們這樣做等。
謝謝。
+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+ +〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜+〜
注:
我不想檢索通過獲取幫助的信息,而是填充某些類型的屬性:System.Management.Automation.FunctionInfo:
Get-Command -Type Function -Name Get-AllColors | Get-Member
TypeName: System.Management.Automation.FunctionInfo
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ResolveParameter Method System.Management.Automation.ParameterMetadata ResolveParameter(string name)
ToString Method string ToString()
CmdletBinding Property bool CmdletBinding {get;}
CommandType Property System.Management.Automation.CommandTypes CommandType {get;}
DefaultParameterSet Property string DefaultParameterSet {get;}
Definition Property string Definition {get;}
Description Property string Description {get;set;}
HelpFile Property string HelpFile {get;}
Module Property psmoduleinfo Module {get;}
ModuleName Property string ModuleName {get;}
Name Property string Name {get;}
Noun Property string Noun {get;}
Options Property System.Management.Automation.ScopedItemOptions Options {get;set;}
OutputType Property System.Collections.ObjectModel.ReadOnlyCollection[System.Management.Automation.PS...
Parameters Property System.Collections.Generic.Dictionary[string,System.Management.Automation.Paramet...
ParameterSets Property System.Collections.ObjectModel.ReadOnlyCollection[System.Management.Automation.Co...
RemotingCapability Property System.Management.Automation.RemotingCapability RemotingCapability {get;}
ScriptBlock Property scriptblock ScriptBlock {get;}
Source Property string Source {get;}
Verb Property string Verb {get;}
Version Property version Version {get;}
Visibility Property System.Management.Automation.SessionStateEntryVisibility Visibility {get;set;}
HelpUri ScriptProperty System.Object HelpUri {get=$oldProgressPreference = $ProgressPreference...
另一種方式來問的是「爲什麼會出現這樣的類型,如果沒有辦法用值填充屬性並通過Select-Object -Property檢索它們?「
謝謝。
Brian/@Matt - – catiarx