<html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head2" runat="server">
        <title>Run Executable HTA</title>

        <script language="javascript" type="text/javascript">
        function RunEXE()
        {
            var oShell = new ActiveXObject("WScript.Shell");
            var prog = "c:\\WINDOWS\\system32\\notepad.exe";
            oShell.Run('"'+prog+'"',1);
        }
        </script>

    </head>
    <body>
        <input id="Button1" onclick="RunEXE()" type="button" value="Notepad" />
    </body>
    </html>

not working, ActiveX is not defined error .

ActiveX is only on IE browser. JavaScript, normally and supposedly, does not have authority to access local drive due to security issue. ActiveX allows JavaScript to access, but the client has to manually accept the action as well. What browser did you test it with? FF? Opera? Not IE?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.