Exécuter cmd à partir d'un navigateur par JS

Je veux ouvrir la fenêtre cmd à partir de ma page web(HTML). J'utilise du JS, mais quelque chose n'est pas juste parce que quand j'ai de la presse, la fonction n'est pas appelée.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
<!--
function runCmd(command, option)
{
    var char34 = String.fromCharCode(34);
    var wsh = new ActiveXObject('WScript.Shell');
    if (wsh)
    {
        command = 'cmd /k ' + char34 + wsh.ExpandEnvironmentStrings(command) + ' ';
        command = command + char34 + wsh.ExpandEnvironmentStrings(option) + char34  + char34;
        if (confirm(command))
        {
            wsh.Run(command);
        }
    }
}
//-->
</script>
</head>

<body>

<input type="button" value="Run!" onclick="runCmd(‘notepad.exe’, ‘%programfiles%\file.txt’);" />
</body>
</html> 

EDIT:
Je l'ai enregistré en tant que PHP et maintenant j'ai une erreur dans FF:

ActiveXObject is not defined
[Break on this error] var wsh = new ActiveXObject('WScript.Shell'); 

Merci!

  • Dans quel navigateur? Vous utilisez internet explorer et de la page dans un site web de confiance, correct? (Ou tout ce qui est nécessaire pour IE exécuter un de ces potentiellement dangereux trucs)
  • dans IE et FF...Oui,site web de confiance.
  • Et vous bien que eval() était mal...
  • Firefox ne prend pas en charge les contrôles ActiveX: support.mozilla.com/en-US/kb/activex
  • ohhhh....C'est sucer. Merci
InformationsquelleAutor Ronny | 2010-11-18