I just want to open a notepade.exe using html Js ,I tried this code but its not working Can any one help me over this. This file is run.html !!!
<html>
<head>
<script>
alert("hi");
<!-- myWindow.close(); -->
var param1var = window.location.search.replace( "?", "" );
alert(param1var);
var oShell = new ActiveXObject("Shell.Application");
var commandtoRun = "C:\\Windows\\notepad.exe";
oShell.ShellExecute(commandtoRun,"","","open","1");
window.close()
</script>
</head>
</html>
-
Define "it's not working". What happens? Do you get an error?Gergo Erdosi– Gergo Erdosi2014年06月27日 11:17:37 +00:00Commented Jun 27, 2014 at 11:17
-
Possible duplicate with stackoverflow.com/questions/3152482/running-exe-from-javascriptDean.DePue– Dean.DePue2014年06月27日 11:19:49 +00:00Commented Jun 27, 2014 at 11:19
-
I just used notepad and can see an error in console says "Uncaught ReferenceError: ActiveXObject is not defined "Vignesh Marteen– Vignesh Marteen2014年06月27日 11:21:20 +00:00Commented Jun 27, 2014 at 11:21
-
@VigneshMarteen Are you trying to run this code in Internet Explorer? ActiveXObject can be used only in IE.Gergo Erdosi– Gergo Erdosi2014年06月27日 11:23:17 +00:00Commented Jun 27, 2014 at 11:23
-
hi Dean.DePue, I tried the same link and copied the output and pasted it here. Even though its not running.Vignesh Marteen– Vignesh Marteen2014年06月27日 11:24:34 +00:00Commented Jun 27, 2014 at 11:24
1 Answer 1
Open Internet Explorer and change / enable these two settings
Tools > Internet Options > Security > Custom level > ActiveX Controls and plug-ins > Initialize and script ActiveX controls not marked as safe for scripting
Tools > Internet Options > Advanced > Security > Allow Active Content to run in files on My Computer
Just in case, restart Internet Explorer
Comments
Explore related questions
See similar questions with these tags.