Forum Discussion

sowmya_bs's avatar
sowmya_bs
Contributor
16 years ago
Solved

How to Execute command line utilities from within a testcomplete script

Hi.. Can anyone please let me know on how to execute the command line utilities from within a testcomplete script file and read the data from that. Immediate reply is appreciated  -Thanks ...
  • AlexeyKolosov's avatar
    14 years ago

    Hello Stephanie,





    You can use the second approach from the mentioned article. The code below executes the ipconfig command and posts the contents of the command prompt window to the test log line by line:







      var p, w, txt, cnt, i, s;

      p = Sys.Process("cmd");

      w = p.Window("ConsoleWindowClass", "*");

      w.Keys("ipconfig [Enter]");

      txt = w.wText;

      aqString.ListSeparator = "\r\n";

      cnt = aqString.GetListLength(txt);

      for (i = 0; i < cnt; i++)

      {

        s = aqString.GetListItem(txt, i);

        Log.Message(s);

      }