Forum Discussion

shantlk's avatar
shantlk
Contributor
7 years ago

How to close (kill) the TestExecute process using commandline

Hi,

I need to launch TestExecute / TestComplete through commandline, run a project and then close TestExecute/ TestComplete after the run. I'm able to launch and run the project, but I cannot closet the program afterwards.

I tried following command but it doesn't do anything.

Tasklill /im TestExecute.exe /t

 

Appreciate if someone can help me with this.

Thank you !

 

  • did you start command line as ...?

    start "My Title" /wait TestComplete.exe "C:\Work\My Projects\MySuite.pjs" /run /exit /SilentMode    

    ...will auto exist after compleating. (note start and exit command....)

     

    if you need to forcefully search and kill TC instances can use 

    tasklist /FI "IMAGENAME eq TestComplete.exe" 2>NUL | find /I /N "TestComplete.exe">NUL
    if "%ERRORLEVEL%"=="0" taskkill /F /IM "TestComplete.exe" /T
  • As NisHera suggested, running TestComplete/TestExecute from the commandline, if you include the /exit or /e switch, once the test run is completed, this will close the tool.  This is the recommended way of doing so.


  • Note:

    Following error is displyed:

     

    ERROR: The process with PID 15188 (child process of PID 9316) could not be terminated.
    Reason: Access is denied.

    • NisHera's avatar
      NisHera
      Valued Contributor

      did you start command line as ...?

      start "My Title" /wait TestComplete.exe "C:\Work\My Projects\MySuite.pjs" /run /exit /SilentMode    

      ...will auto exist after compleating. (note start and exit command....)

       

      if you need to forcefully search and kill TC instances can use 

      tasklist /FI "IMAGENAME eq TestComplete.exe" 2>NUL | find /I /N "TestComplete.exe">NUL
      if "%ERRORLEVEL%"=="0" taskkill /F /IM "TestComplete.exe" /T
      • shantlk's avatar
        shantlk
        Contributor

        Thanks a lot ! It's working now ! :smileyhappy:

    • shankar_r's avatar
      shankar_r
      Community Hero

      You need to run your command line as Administrator.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        As NisHera suggested, running TestComplete/TestExecute from the commandline, if you include the /exit or /e switch, once the test run is completed, this will close the tool.  This is the recommended way of doing so.