Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Close Command prompt using Vbscript

This is a discussion on Close Command prompt using Vbscript within the QTP forums, part of the Software Testing category; How to close the Command prompt using Vbscript Using batch file i am opening the any application by mentioning the path but that application is opening along with command prompt ...

Go Back   Geeks Talk > Software Testing > QTP
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 01-09-2008
Junior Member
 
Join Date: Dec 2007
Location: pune
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
pradeep.madishetti is on a distinguished road
Close Command prompt using Vbscript

How to close the Command prompt using Vbscript

Using batch file i am opening the any application by mentioning the path but that application is opening along with command prompt also showing. please let me know how to close the command prompt not an application
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-13-2008
Moderator
 
Join Date: Oct 2007
Location: Frankfort, KY
Posts: 283
Thanks: 3
Thanked 54 Times in 36 Posts
Anshoo_Arora is on a distinguished road
Re: Close Command prompt using Vbscript

Try this:

Sub cmdClose()
Dim oCMD
Set oCMD=GetObject("WSCript.shell")
oCMD.Close
Set oCMD=Nothing
End Sub
Reply With Quote
  #3 (permalink)  
Old 01-15-2008
Expert Member
 
Join Date: Jul 2007
Location: Kolkata
Posts: 182
Thanks: 7
Thanked 17 Times in 16 Posts
animesh.chatterjee is on a distinguished road
Re: Close Command prompt using Vbscript

hei it is not working in my machine...I have XP...
Reply With Quote
  #4 (permalink)  
Old 01-15-2008
Expert Member
 
Join Date: Jul 2007
Location: Kolkata
Posts: 182
Thanks: 7
Thanked 17 Times in 16 Posts
animesh.chatterjee is on a distinguished road
Re: Close Command prompt using Vbscript

it is giving a runtime error..
Reply With Quote
  #5 (permalink)  
Old 01-17-2008
Junior Member
 
Join Date: Sep 2007
Location: Bengaluru
Posts: 16
Thanks: 2
Thanked 1 Time in 1 Post
ravisuriya is on a distinguished road
Re: Close Command prompt using Vbscript

Friends,

This works for me on using it after writing the script for closing all the unwanted application. Let me know, for your testing it helps or not. I am waiting...



Set oShell = CreateObject("WScript.Shell")
Set oWmg = GetObject("winmgmts:")

strWndprs = "select * from Win32_Process where name='cmd.exe'"
Set objQResult = oWmg.Execquery(strWndprs)

For Each objProcess In objQResult

intReturn = objProcess.Terminate(1)

Next

Last edited by ravisuriya; 01-17-2008 at 02:06 AM.
Reply With Quote
The Following User Says Thank You to ravisuriya For This Useful Post:
  #6 (permalink)  
Old 01-18-2008
Expert Member
 
Join Date: Jul 2007
Location: Kolkata
Posts: 182
Thanks: 7
Thanked 17 Times in 16 Posts
animesh.chatterjee is on a distinguished road
Thumbs up Re: Close Command prompt using Vbscript

Nice work man...
GR8 work done...
Its working.....
Reply With Quote
Reply

  Geeks Talk > Software Testing > QTP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
I have 2 browsers open having the same title and I want to close the second browser? rkiran416 QTP 6 05-25-2009 10:28 AM
Invoke QTP script from command prompt Geek_Guest QTP 2 01-28-2009 12:35 AM
Start a TestSet via Command Prompt Geek_Guest QTP 0 10-22-2007 02:55 PM
Pre-defined prompt and Report level prompt Geek_Guest Data Warehousing 1 07-03-2007 03:52 AM
Compile a C program using command prompt priyajos C and C++ 2 05-17-2007 08:52 AM


All times are GMT -4. The time now is 08:06 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved