Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i save DOS proj output to a file?

Status
Not open for further replies.

robbaggio

Programmer
Jun 11, 2002
31
US
If in my VB program one button click runs a dos program with certain arguments. This dos program spits outs some txt to the dos screen that pops up, but the screen closes immediatley. Therefore I want to save what it spits out to a txt file, so the user can see the results. How can i do this?

robbaggio
 
You won't be able to capture the DOS screen text in VB. You will have to get a DOS screen scrapper program.
 
Is there anyway i can keep the DOS screen up then, that is make it so it doesnt terminate immediately after it is done running?

robbaggio
 
Can you run the dos program and redirect its output to a file using the redirection operator ">"?

e.g. dosprog /arg1 /arg2 > out.dat

Hope this helps. CaKiwi
 
you could create a batch file that runs the dos program.

At the end of the batch file add

Pause

and then execute the batch file from vb

if it is a precompiled dos program this may not work and you definately won't be able to redirect the output. If the pause deal doesn't work then you'll have to get what IFELSETHEN was talking about...
 
CaKiwi's solution will work if the DOS prog uses standard output, which can be redirected. append "> filename.ext" to your program name. > sign replaces the file if it exists, while >> will append to it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top