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 badges3 Answers
Reset to default 10It's necessary to have two settings turned on.
- 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"
- 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!?