最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - permission denied with shell.application - Stack Overflow

programmeradmin5浏览0评论

I have following javascript code to run notepade.exe:

<SCRIPT type="text/javascript" LANGUAGE="JavaScript">  
  function executeCommands()
   {            
    var oShell = new ActiveXObject("Shell.Application");     
    var mandtoRun ="C:\WINDOWS\notepad.exe";
    oShell.ShellExecute(mandtoRun,"","", "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?

I have following javascript code to run notepade.exe:

<SCRIPT type="text/javascript" LANGUAGE="JavaScript">  
  function executeCommands()
   {            
    var oShell = new ActiveXObject("Shell.Application");     
    var mandtoRun ="C:\WINDOWS\notepad.exe";
    oShell.ShellExecute(mandtoRun,"","", "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?

Share Improve this question edited Jul 16, 2016 at 10:36 mpromonet 12k43 gold badges66 silver badges97 bronze badges asked Dec 21, 2010 at 6:09 jitendrajitendra 5774 gold badges11 silver badges17 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 10

It's necessary to have two settings turned on.

  1. Enable unsigned ActiveX controls for the current zone
    Tools > Internet Options > Security > Custom level...
    Enable "ActiveX Controls and plug-ins" > "Initialize and script ActiveX controls not marked as safe for scripting"

  2. Allow Active Content to run files
    Tools > Internet Options > Advanced > Security Enable "Allow Active Content to run in files on My Computer"

    ** Make sure to close all your IE browser windows.

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:
  • "Allow Active Content to run in files on My Computer"

The above is for IE, but most browsers have similar options.

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; Not quite sure why that should solve the problem, but maybe that'll help someone!?

发布评论

评论列表(0)

  1. 暂无评论