简体   繁体   English

权限被 shell.application 拒绝

[英]permission denied with shell.application

I have following javascript code to run notepade.exe:我有以下 javascript 代码来运行 notepade.exe:

<SCRIPT type="text/javascript" LANGUAGE="JavaScript">  
  function executeCommands()
   {            
    var oShell = new ActiveXObject("Shell.Application");     
    var commandtoRun ="C:\WINDOWS\notepad.exe";
    oShell.ShellExecute(commandtoRun,"","", "open", "1");               
  }
</SCRIPT>

The problem is that, when i run the script then it give error..."Permission denied."问题是,当我运行脚本时,它会给出错误...“权限被拒绝。”

Can anybody help me on this matter?有人可以帮我解决这个问题吗?

It's necessary to have two settings turned on.有必要打开两个设置。

  1. Enable unsigned ActiveX controls for the current zone为当前区域启用未签名的 ActiveX 控件
    Tools > Internet Options > Security > Custom level...工具 > Internet 选项 > 安全 > 自定义级别...
    Enable "ActiveX Controls and plug-ins" > "Initialize and script ActiveX controls not marked as safe for scripting"启用“ActiveX 控件和插件”>“初始化未标记为安全脚本的 ActiveX 控件并为其编写脚本”

  2. Allow Active Content to run files允许活动内容运行文件
    Tools > Internet Options > Advanced > Security Enable "Allow Active Content to run in files on My Computer"工具 > Internet 选项 > 高级 > 安全启用“允许活动内容在我的电脑上的文件中运行”

    ** Make sure to close all your IE browser windows. ** 确保关闭所有 IE 浏览器窗口。

You may experience a "Permission denied" error, which means that the browser will not let script execute outside the "sandbox".您可能会遇到“权限被拒绝”错误,这意味着浏览器不会让脚本在“沙箱”之外执行。 Try solving the issue by changing a security setting in the browser:尝试通过更改浏览器中的安全设置来解决问题:

  • Internet Options, Advanced, Security: Internet 选项、高级、安全:
  • "Allow Active Content to run in files on My Computer" “允许活动内容在我的电脑上的文件中运行”

The above is for IE, but most browsers have similar options.以上是针对 IE 的,但大多数浏览器都有类似的选项。

Okay, weirdly, I had this issue when running a.html file I'd created on my desktop into IE... but when I moved the file onto a WAMPServer it worked okay;好吧,奇怪的是,我在将我在桌面上创建的 .html 文件运行到 IE 时遇到了这个问题......但是当我将文件移动到 WAMPServer 时它工作正常; Not quite sure why that should solve the problem, but maybe that'll help someone??不太确定为什么要解决问题,但也许这会对某人有所帮助?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM