How to configure IE to make wscript.shell work

I have a code that worked. But I am today when I try again. I kept getting "[object error]".

I thought this was an IE security issue. But I can find how to configure IE to work.

function Run() { try { var objShell = new ActiveXObject("wscript.shell"); objShell.Run("calc"); } catch(e) { alert(e); } } 
+6
javascript
source share
3 answers

You must enable ActiveX:

  • Click "Service"
  • Select "Internet Options" ...
  • Select the Security tab.
  • Select the Internet in the web content area.
  • Then click on "User Level" ...
  • Go through all the ActiveX settings, select "Hint" or "Enable"
+17
source share

it is case sensitive !!

 <html> <head> <script language="javascript" type="text/javascript"> function OpenFile(){ alert ('Work'); var x = new ActiveXObject("WScript.Shell"); x.run('calc.exe'); } </script> </head> <body> <input type="button" value="GG" href="#" onclick="javascript:OpenFile();"> </body> </html> 
+4
source share

You may need to make changes to your IE settings:

For example, for a local intranet zone, it is usually necessary to change a configurable parameter: "Initialize and script ActiveX controls that are not marked as script-safe."

I could not get the sample above to work without making changes.

+4
source share

All Articles