VB“Automation 错误” 或 “无法定位程序输入点 DoOpenPipeStream 于动态链接库ScrRun.dll上”

说明“Automation 错误”其实是VB调用程序或组件时,程序或组件返回的错误,因此需要考虑这些组件是否能正确运行

如在某些机器上运行以下代码时:

会产生“AutoMation 错误”,原因是"Wscript.Shell"无法正常运行

 

-------------------------------------------------------------------------------------------------------------------------

以下方法转自网络,已经成功地解决问题!

 

错误消息和前面的一样“WSript.exe - 无法找到入口 ”,无法创建名为“Wscript.Shell”的对象。于是开始了疯狂百度,原因是说要么脚本被禁用(不可能,因为弹出消息来了嘛),二是文件被改动。网上一般是说注册两个组件就OK了,如下:

regsvr32 srcrun.dll    (命令成功)
regsvr32 wshom.ocx   (弹出错误提示:无法定位程序输入点 DoOpenPipeStream 于动态链接库ScrRun.dll上)

前一个执行成功,后一个怎么弄都是错误,消息是“LoadLibary("wshom")失败,找不到指定的程序”,看了看system32目录下,wshom.ocx是有的。后来开始认识到可能是wshom.ocx被破坏了,于是找了相同版本的电脑(我的是XP SP3),然后写段脚本,把下面的文件拷出来:

mkdir c:/repair
set source=%windir%/system32
set target=c:/repair
copy %source%/cscript.exe %target%
copy %source%/jscript.dll %target%
copy %source%/scrobj.dll %target%
copy %source%/scrrun.dll %target%
copy %source%/vbscript.dll %target%
copy %source%/wscript.exe %target%
copy %source%/wshext.dll %target%
copy %source%/wshom.ocx %target%
pause

并将对方机器上的c:/repair目录拷贝到我的c:/下,然后用下列脚本更新:

set source=c:/repair
set target=%windir%/system32
copy %source%/cscript.exe %target%
copy %source%/jscript.dll %target%
copy %source%/scrobj.dll %target%
copy %source%/scrrun.dll %target%
copy %source%/vbscript.dll %target%
copy %source%/wscript.exe %target%
copy %source%/wshext.dll %target%
copy %source%/wshom.ocx %target%
regsvr32 %target%/jscript.dll
regsvr32 %target%/scrobj.dll
regsvr32 %target%/scrrun.dll
regsvr32 %target%/vbscript.dll
regsvr32 %target%/wshext.dll
regsvr32 %target%/wshom.ocx
pause

完成后使用脚本测试CreateObject("WScript.Shell")成功, 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值