ShellExecute permission denied in windows

SantoshKumar picture SantoshKumar · Oct 30, 2012 · Viewed 9.8k times · Source

Can someone tell me why permission is denied to run a shell command in windows and how to resolve?

function executeCommands(inputparms)
{
  var oShell = new ActiveXObject("Shell.Application");
  var commandtoRun = "C:\\WINDOWS\\Notepad.exe";
  if (inputparms != "")
  {
    var commandParms = document.Form1.filename.value;
  }
  oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1");
}

Answer

caspian picture caspian · Mar 25, 2013

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.**

Note : as displayed at the bottom of the "Internet Options > Advanced > Security" block, the computer must be restarted for this option to be taken into account.