We help IT Professionals succeed at work.

Sending Inputs to DOS Apps.

nbishop
nbishop asked
on
Medium Priority
189 Views
Last Modified: 2010-04-30
Basically, I want to run a DOS executable in a "BATCH" mode.
The original design of the DOS app did NOT take into accout command line arguments, or script files.  SO, what I would like to do is programatically send inputs to a running DOS window (Or any other way possible to run the program repeatedly, and unattended).  Is this possible?
Comment
Watch Question

Try something like this

Dim ret As Long
ret = Shell("Path and Batch Filename", vbNormalFocus)
SendKeys "{RIGHT}", True

Author

Commented:
raygibbins.  Your solution seems to work well for Windows applications, but I really need a sendkeys function for a DOS window.
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Not exactly what I was hoping to hear, but I think I can work with that.  I have read about an API call to the function sendMessage, but haven't really been successful. Any ideas about that?

Commented:
Make a new project and then add a new commandbutton. Type in this code in your commandbutton. I have tryed this on windows programs and it works But I don’t see why it wont work in dos.  

Sub Command1_Click()
   
MyApp shell("C:\Example.exe", 1) 'You put in your own          
                                 'Program here

AppActivate MyApp                'Runs the program Example.exe  

   'Send the string and hit enter to the current
   'window in "C:\Example.exe"
   SendKeys "This is a simple test{ENTER}"
End Sub
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.