【发布时间】:2018-02-09 10:04:11
【问题描述】:
根据this TechNet article关于PowerShell类型加速器的说法,有几十个类型别名称为类型加速器。确实,下面的命令
[psobject].Assembly.GetType("System.Management.Automation.TypeAccelerators")::get
在我的系统上返回 80 个加速器。
但是,它的简写 [accelerators]::get 似乎失败了:
找不到类型加速器。确保装配 包含此类型已加载。在 line:1 char:1
+ CategoryInfo : InvalidOperation: (accelerators:TypeName) [], RuntimeException + FullyQualifiedErrorId : TypeNotFound
我还尝试在发出命令之前使用[System.Reflection.Assembly]::LoadWithPartialName("System.Management.Automation.TypeAccelerators") 动态加载System.Management.Automation.TypeAccelerators 程序集,但仍然失败。
$PSVersionTable 返回以下数据:
Name Value
---- -----
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.42000
BuildVersion 6.3.9600.18728
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2
操作系统是 Windows 7 x64。
如何快速获取 PowerShell 类型加速器列表?
【问题讨论】:
标签: powershell powershell-4.0 type-accelerators