【发布时间】:2012-01-11 08:54:27
【问题描述】:
如何在 PowerShell 中创建 IShellLibrary (http://msdn.microsoft.com/en-us/library/windows/desktop/dd391719(v=vs.85).aspx) 实例? IShellLibrary 接口使从代码管理@987654322@ 成为可能。
Shell.Application COM 对象是否实现了IShellLibrary 接口?是否可以在 PowerShell 中将 shell 对象转换为 IShellLibraryinstance?以下是如何在 PowerShell 中创建 Shell.Application 实例的示例:
New-Object -ComObject Shell.Application
当我尝试投射对象时,结果是:
PS C:\Users\knut> [IShellLibrary](New-Object -ComObject Shell.Application)
Unable to find type [IShellLibrary]: make sure that the assembly containing this type is loaded.
At line:1 char:16
+ [IShellLibrary] <<<< (New-Object -ComObject Shell.Application)
+ CategoryInfo : InvalidOperation: (IShellLibrary:String) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
IShellLibrary 接口在哪里?如何将其导入 PowerShell 会话?
【问题讨论】:
标签: windows com powershell