recuperer le errorlevel dans un WScript.Shell
Bonjour,
Dans le script ci-dessous, extrait d'un fichier.hta, j'appelle une fonction qui fais un "REG QUERY" d'une cl� de registre qui n'existe pas. J'aimerais trapper l'erreur comme cela fonctionne avec ERRORLEVEL sous DosShell, mais ma fonction me retourne toujours 0 au lieu de 1.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| function HRAccessPresent()
{
try {
var oSH = new ActiveXObject("WScript.Shell");
intReturn = oSH.Run('cmd /K CD & REG QUERY "HKLM\SOFTWARE\IBM\INEXISTANT", 1, TRUE & Echo %ERRORLEVEL%');
alert("le code retour est " + intReturn);
}
catch(e)
{
txt="J'ai rencontré une erreur.\n\n";
txt+="Error description: " + e.description + "\n\n";
txt+="Click OK pour continuer.\n\n";
alert(txt);
}
} |
Quelqu'un peut-il m'aider ?
Merci
Bruno