jitendra
jitendra

Reputation: 577

permission denied with shell.application

I have following javascript code to run 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?

Upvotes: 7

Views: 14869

Answers (3)

Patrick Dean
Patrick Dean

Reputation: 1

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!?

Upvotes: 0

caspian
caspian

Reputation: 1804

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.

Upvotes: 10

MAbraham1
MAbraham1

Reputation: 1768

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.

Upvotes: 1

Related Questions