Link to home
Start Free TrialLog in
Avatar of Ierokish
Ierokish

asked on

Java script cmd

I'm from Russia, I'm sorry for my English, I use google translator
I'm using the HTA file. It is necessary that when the console starts (cmd), which this hta file does, the command is executed and the ENTER key is pressed. My code, but it's probably incorrect.

       
 var cmdRun;
  function kb(userid, token, server, options) {

        var autoR = document.getElementById('a-r');
        var autoC = document.getElementById('a-c');
        var path = "cmd /c chcp 65001 & cmd.exe -t " + token + " -i " + userid + " -f ./kfa/nonever/" + server + ".cfg " + options;
        var WshShell = new ActiveXObject("WScript.Shell");                      
        function st () {
            //WshShell.Exec("exec zzz");
            cmdRun.StdIn.WriteLine("exec zzz");
        }                                            

        if (autoR.checked && autoC.checked) {                
            cmdRun  = WshShell.Run(path, 2);                
            setTimeout(st, 20000);
            setTimeout(function() {
                if (autoR.checked) {                        
                    login();
                }
            }, 60000);                
        } else if (autoR.checked) {
            cmdRun = WshShell.Run(path);
            setTimeout(setCon, 2000);
            setTimeout(function() {
                if (autoR.checked) {
                    login();
                }
            }, 60000);           
        } else if (autoC.checked) {
           cmdRun = WshShell.Run(path, 2);
            setTimeout(st, 11000);
        } else {                               ;
            cmdRun = WshShell.Run(path);
            //setTimeout(setCon, 2000);                
        }                    

  }

Open in new window

Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

can you send the complete hta
Avatar of Ierokish
Ierokish

ASKER

David Johnson, please check your personal messages, the file is sent.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.