我想填充我在 $PROFILE 中创建的 Powershell 函数的 Description 属性。我想向“描述”属性添加一个值,例如“在个人配置文件中创建”。这可能吗?
目前,如果我检查我的功能描述,我发现没有填充任何内容,例如:
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
填充该值将使我能够搜索并快速查看我的函数是在哪里创建的,或者它们做什么,等等。
谢谢。
+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~+~ +~+~+~+~+~+~+~+~+~+~+~+~+~+~+~
Note:
我不想通过 Get-Help 检索信息,而是填充 Type: 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 检索它们,为什么会有这样的类型?”
谢谢。