New-CrescendoCommand
创建 PowerShell 命令对象。
语法
Default (默认值)
New-CrescendoCommand
[-Verb] <String>
[-Noun] <String>
[[-OriginalName] <String>]
[<CommonParameters>]
说明
创建 PowerShell 命令对象。 可以使用此对象来设置要定义的命令的属性。 生成的对象可以转换为要添加到配置文件中的 JSON。
示例
示例 1 - 创建新命令并将其转换为 JSON
New-CrescendoCommand -Verb Get -Noun Something -OriginalName "native.exe" | ConvertTo-Json
{
"Verb": "Get",
"Noun": "Something",
"OriginalName": "native.exe",
"OriginalCommandElements": null,
"Platform": [
"Windows",
"Linux",
"MacOS"
],
"Elevation": null,
"Aliases": null,
"DefaultParameterSetName": null,
"SupportsShouldProcess": false,
"ConfirmImpact": null,
"SupportsTransactions": false,
"NoInvocation": false,
"Description": null,
"Usage": null,
"Parameters": [],
"Examples": [],
"OriginalText": null,
"HelpLinks": null,
"OutputHandlers": null,
"FunctionName": "Get-Something"
}
参数
-Noun
要定义的 cmdlet 的名词。
参数属性
| 类型: | String |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | 1 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-OriginalName
要运行的本机命令可执行文件的名称。
参数属性
| 类型: | String |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | 2 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Verb
要定义的 cmdlet 的谓词。
参数属性
| 类型: | String |
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | 0 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。