无法在 Windows 7 x64 上使用 VB 脚本中的 CreateObject [英] Cannot use CreateObject from VB scripts on Windows 7 x64
问题描述
当我尝试在 Windows 7(64 位)机器上的 VB 脚本中创建 COM 对象时,我总是收到以下错误:
When I try to create a COM object in VB script on a Windows 7 (64 bit) machine, I always get the following error:
"ActiveX 组件无法创建对象'xxx.xxx'.代码:800A01AD
"ActiveX component can't create object 'xxx.xxx'. Code: 800A01AD
我的应用程序使用 COM 对象没有任何问题.我试过在管理员模式下运行命令行,没有区别.
I have applications that use the COM object without any problem. I have tried running the command line in admin mode, no difference.
有什么办法可以实现吗?
Is there any way to enable this?
推荐答案
VBScript 解释器 (cscript.exe/wscript.exe) 在 64 位版本的 Windows 上有两种版本:32 位版本和 64-bit 版本.
The VBScript interpreter (cscript.exe/wscript.exe) comes in two flavors on a 64-bit version of Windows: a 32-bit version and a 64-bit version.
32位版本只能创建和使用32位COM组件,64位版本只能创建和使用64位COM组件.
The 32-bit version can create and use 32-bit COM components only, and the 64-bit version can create and use only 64-bit COM components.
默认情况下,.vbs 文件与 64 位版本相关联.您的 COM 组件很可能是 32 位的,因此会出现错误.
By default, .vbs files are associated with the 64-bit version. You COM component is most likely a 32-bit one, hence the error.
您可以在 %windir%SysWOW64
文件夹中找到 32 位版本.启动此版本应该可以让您访问所有 32 位 COM 组件:
You can find the 32-bit version in the %windir%SysWOW64
folder. Launching this version should give you access to all 32-bit COM components:
%windir%SysWOW64wscript.exe myScript.vbs
或
%windir%SysWOW64cscript.exe myScript.vbs
这篇关于无法在 Windows 7 x64 上使用 VB 脚本中的 CreateObject的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!