Discussion Locked

Executing/Handling DOS program within VB

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Here is a very tough problem I have been working on for over 2 weeks now and its driving me insane. There is very little reference if any regarding this topic on the internet that I have found relevant to my current situation.

I am attempting to run the runas.exe command using VB6 to automate the password input process. I have gotten to a point where I can call the program and even output text to the same dos box. However, I can't use this output to the dos box to be accepted by the runas.exe as the password.

Basically I want to be able to control a DOS application from within VB6 and bundle it up so it plays nice with a locked down system for distributing patches to end users.

Is there a way to grab output from a DOS application, pass it to the VB6 application, and send this data back out to the DOS application and let the DOS application do its thing?

I have read about this StdOut and StdIn but my MSDN cd only shows me C++ coding examples, nothing about VB6 so i'm at a real loss here on what to do.

If anyone has generic ideas or specific ones related to this I would greatly appreciate it.

3 replies

by jackofalltech

Use SendKeys {alt}{space} to open the menu, e for edit, s for select all, then y for copy. Use the GetClipboard text function to put it into a string variable and parse. Use SendKeys again to supply the password.

I don't have VB installed on the PC I'm on right now so I can't give you the correct syntax so use the Help.

If you still have problems, email me and I'll get the details for you at home.

Ralph

by merc3065

SendKeys command ends up generating more DOS windows running runas.exe than you can shake a stick at for some unknown reason. This is even when you specifically put a single Shell() statement into the program. Using the SendKeys and copy/pasting to and from the clipboard is also a high risk security issue when dealing with administrator passwords. If you have other information on how to work using runas.exe or possible an internal win32 API call(i've been reading bits and pieces about that) please let me know.

This discussion is closed to new replies.