Forum Discussion

hc_vinod's avatar
hc_vinod
Occasional Contributor
9 years ago

passing arguments as parameter to command prompt

Hi ,    I need to open a command prompt from my script and need to enter some comands , and these commands i need to pass as a parameter    Something like : i need to open CMD prompt and enter pi...
  • joseph_michaud's avatar
    9 years ago

    Try

     

      var cmd = "ping 127.0.0.1";
      var oShell = Sys.OleObject("WScript.Shell");
      var ret = oShell.run("cmd /C " + cmd, 1, true);
      Log.Message("ret = " + ret);

    See Microsoft docs for more info: Run Method