Permission denied using shell.application

I have the 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 gives an error ... "Permission denied."

Can someone help me on this?

+7
source share
2 answers

You need to enable two settings.

  • Enable unsigned ActiveX controls for the current zone

    Tools> Internet Options> Security> User Level ...

    Enable "ActiveX Controls and Plugins"> "Initialize and Script ActiveX Controls Not Marked As Script-Safe"


  • Allow active content to run files

    Tools> Internet Options> Advanced> Security Enable "Allow active content to work on files on my computer"



    ** Be sure to close all IE browser windows.
+8
source

You may receive a “Permission to Deny” error, which means that the browser will not allow the script to execute outside the sandbox. Try to solve the problem by changing the security setting in the browser:

  • Internet Options, Advanced, Security:
  • "Allow active content to work on files on my computer"

The above applies to IE, but most browsers have similar options.

+1
source

All Articles