Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


controlling a Command Prompt(DOS) window

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,40612
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> controlling a Command Prompt(DOS) window
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 controlling a Command Prompt(DOS) window - 12/7/2006 11:30:43 PM   
  thorwath


Posts: 42
Score: 0
Joined: 12/6/2006
From: Grand Rapids, MI
Status: offline
I am new to this forum, as well as to vbScript. I have searched the forum for posts containing
"Command Prompt" --many of which described the use of wshShell.Exec and wshShell.Run
but neither seem to support what I need.
 
So, what I want to do is write three functions:
 
--Func1: open a DOS window that persists until I call Func3.
 
--Func2: called with a string; writes that string to the DOS window, where
               previous strings scroll up one line.
 
--Func3: close the DOS window opened in Func1.
 
Is this possible with vbScript?
 
-Thanks, Terry
 
 
 
Post #: 1
 
 RE: controlling a Command Prompt(DOS) window - 12/8/2006 1:24:58 AM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
Call sub1
WScript.Sleep 3000
Call sub2
WScript.Sleep 3000
Call sub3
Sub sub1
CreateObject("Wscript.Shell").Run "%comspec% /k title MyShell",1,False
End Sub
Sub sub2
CreateObject("Wscript.Shell").AppActivate "MyShell"
CreateObject("Wscript.Shell").SendKeys "dir c:\Windows /a{ENTER}"
End Sub
Sub sub3
CreateObject("Wscript.Shell").AppActivate "MyShell"
CreateObject("Wscript.Shell").SendKeys "exit{ENTER}" 
End Sub

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to thorwath)
 
 
Post #: 2
 
 RE: controlling a Command Prompt(DOS) window - 12/8/2006 1:25:12 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
It is possible. Look at the .Execute method of the WScript.Shell object.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to thorwath)
 
 
Post #: 3
 
 RE: controlling a Command Prompt(DOS) window - 12/8/2006 7:01:23 AM   
  thorwath


Posts: 42
Score: 0
Joined: 12/6/2006
From: Grand Rapids, MI
Status: offline
Digital,
 
This code got me started.
 
-Much Thanks, Terry

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> controlling a Command Prompt(DOS) window Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts