从 IE8 启动 WSH/VBScript 文件不起作用

发布于 2024-08-18 01:26:07 字数 353 浏览 1 评论 0原文

我使用以下注册表信息在 IE8 中创建了自定义右键菜单元素:

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\WebOn edit] @="c:\\webon_edit\\wo_edit.vbs"

“WebOn edit”选项出现在 IE8 的右键菜单中。在升级到 Windows 7 之前,这工作得很好:当我单击菜单选项时,“wo_edit.vbs”文件运行(使用 cscript)并执行它应该执行的操作。

但现在,什么也没有发生。看起来 cscript 根本没有被调用。

这是由于不使用 IE 中的外部 vbscript 的一些安全限制吗?

I have created a custom rightclick menu element in IE8 using the following registry info:

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\WebOn edit]
@="c:\\webon_edit\\wo_edit.vbs"

The choice "WebOn edit" shows up in IE8's rightclick menu. Before upgrading to Windows 7, this worked fine: When I clicked the menu choice, the "wo_edit.vbs" file ran (using cscript) and did the stuff it was supposed to.

But now, nothing happens. It seems like cscript does not get invoked at all.

Is this due to some security restrictions about not using external vbscript from IE?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

单挑你×的.吻 2024-08-25 01:26:07

您无法直接从 IE8 中的上下文菜单执行 cscript。最简单的选择是将 VBScript 包装在 html 文件中,或者从 html 文件中执行 cscript。然后只需使用上下文菜单调用该 html 即可。

为此,请创建一个包含 vbscript 的 html 文件,或调用 cscript。然后设置注册表字符串以通过 @="file://C:\example.html" 使用该文件。

执行VB示例:

<HTML>
  <HEAD>
    <SCRIPT LANGUAGE="VBScript">
      Sub ShowVBisWorking()
        MsgBox("I'm working")
      End Sub
    </SCRIPT>
  </HEAD>
  <BODY ONLOAD=ShowVBisWorking()>
  <BODY>
</HTML>

执行cscript示例:

<HTML>
  <HEAD>
    <SCRIPT LANGUAGE="VBScript">
      Sub LaunchProcess()
        Dim Shell
        Set Shell = CreateObject("Wscript.Shell")
        Shell.Run "cscript c:\test.vbs",1
        Set Shell = Nothing
      End Sub
    </SCRIPT>
  </HEAD>
  <BODY ONLOAD=LaunchProcess()>
  <BODY>
</HTML>

you cannot execute cscript directly from the context menu in IE8. The simplest option is to either wrap your VBScript inside an html file, or execute cscript from within an html file. Then simply call that html using the context menu.

To do this create a html file with your vbscript in it, or a call to cscript. Then set your registry string to use that file with @="file://C:\example.html".

Execute VB example:

<HTML>
  <HEAD>
    <SCRIPT LANGUAGE="VBScript">
      Sub ShowVBisWorking()
        MsgBox("I'm working")
      End Sub
    </SCRIPT>
  </HEAD>
  <BODY ONLOAD=ShowVBisWorking()>
  <BODY>
</HTML>

Execute cscript example:

<HTML>
  <HEAD>
    <SCRIPT LANGUAGE="VBScript">
      Sub LaunchProcess()
        Dim Shell
        Set Shell = CreateObject("Wscript.Shell")
        Shell.Run "cscript c:\test.vbs",1
        Set Shell = Nothing
      End Sub
    </SCRIPT>
  </HEAD>
  <BODY ONLOAD=LaunchProcess()>
  <BODY>
</HTML>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文