一般来说,我对 COM 和 Windows 编程/脚本非常陌生。我想做的是编写 Windows Live Writer 脚本;根据我可以打电话之前的文件
$o = New-Object -c WindowsLiveWriter.Application
我需要先加载 TLB,所以我应该调用该add-type
命令,不幸的是它失败了:
PS C:\Users\NoWhereMan> add-type windowslivewriter.application
Add-Type : c:\Users\NoWhereMan\AppData\Local\Temp\a7ifbimo.0.cs(1) : A namespace does not directly contain members such
as fields or methods
c:\Users\NoWhereMan\AppData\Local\Temp\a7ifbimo.0.cs(1) : >>> windowslivewriter.application
At line:1 char:9
+ add-type <<<< windowslivewriter.application
+ CategoryInfo : InvalidData: (c:\Users\NoWher...elds or methods:CompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : Cannot add type. There were compilation errors.
At line:1 char:9
+ add-type <<<< windowslivewriter.application
+ CategoryInfo : InvalidData: (:) [Add-Type], InvalidOperationException
+ FullyQualifiedErrorId : COMPILER_ERRORS,Microsoft.PowerShell.Commands.AddTypeCommand
物有所值,我正在运行 Windows7 x64
编辑:x64 是关键问题,我需要将 PSH 作为 x86 进程运行
谢谢