Cannot use CreateObject from VB scripts on Windows 7 x64

后端 未结 1 779
失恋的感觉
失恋的感觉 2020-12-08 10:06

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 component can\'t create object \'xxx.xxx\

相关标签:
1条回答
  • 2020-12-08 10:51

    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.

    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.

    By default, .vbs files are associated with the 64-bit version. You COM component is most likely a 32-bit one, hence the error.

    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%\SysWOW64\wscript.exe myScript.vbs
    

    or

    %windir%\SysWOW64\cscript.exe myScript.vbs
    
    0 讨论(0)
提交回复
热议问题