Forum Discussion

nedbacan's avatar
nedbacan
Frequent Contributor
4 years ago
Solved

Capturing the Command Line of a Process running in the Task Manager

I don't know if this test is possible but I would like to ask the experts if it can be done.   Using TestComplete, is there a way to capture the command line of a process that appears in the Task M...
  • tphillips's avatar
    4 years ago

    One way to do that is using PowerShell

     

    gwmi win32_process | select commandline, name | format-list

     

     I am sure you can massage the data a little better and use a filter to just find "httpd.exe".

  • BenoitB's avatar
    4 years ago

    The simplest way is to use the builtin functions.

     

    let n = "TestComplete";
    let p = Sys.Find("ProcessName", n);
    p.Exists ? Log.Message(p.CommandLine) : Log.Message("Process " + n + " not found !");
    

     

    Or if the process to check is always the same :

    Sys.Process("TestComplete").Exists ? Log.Message(Sys.Process("TestComplete").CommandLine) : Log.Message("Process not found !");