How To Stop Wscript Exe

蹲街弑〆低调 提交于 2019-12-29 09:34:23

问题


I want to shutdown QTP which is invoked through Wscript.exe.


回答1:


I used these three commands and it works perfectly fine.

TASKKILL /F /FI "USERNAME eq Ankita" /IM wscript.exe"
TASKKILL /F /im QTAutomationAgent.exe
TASKKILL /F /im QTPro.exe



回答2:


You cannot create multiple instances of QuickTest Application on a single machine. Even though you say CreateObject("QuickTest.Application") 10 times, all will be holding same instance of the application.

Closing the quickTest using API method described above is the absolute solution.




回答3:


taskkill.exe /IM qtp.exe




回答4:


Killing a process without giving it opportunity to close down properly is not fair.

Here is code sample which can close QTP using its API. It will bind to open QTP application and close it in a graceful manner.

'Create QuickTest.Application object'
Dim oQtpObject : Set oQtpObject = CreateObject("QuickTest.Application")

oQtpObject.Test.Close

'Clean up'
Set oQtpObject = Nothing ' Release the Application object

I haven't got QTP installed and cannot check how this code could be called. You could try calling it directly from QTP script code and if it doesn't work you can create an external script containing quoted code and call it from QTP.



来源:https://stackoverflow.com/questions/3512827/how-to-stop-wscript-exe

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!