Click to See Complete Forum and Search --> : VB in a DOS Batch file
Mark Sreeves
Jan 23rd, 2000, 04:14 PM
I am writing a fairly trival program which will run in a batch file (in a DOS window so vb run files are available)
How do I output text to the dos window(stdout) and is it possible to put errors to stderr?
Next, is it possible to seperate stdout and stderr in a batchfile like you can in a UNIX Shell Script
------------------
Mark Sreeves
Analyst Programmer
Mark.Sreeves@Softlab.co.uk
A BMW Group Company
smalig
Jan 23rd, 2000, 08:48 PM
You can redirect a standard output to the file and then read and display the output data from the Visual Basic application.
Write the .bat file
d:\test.bat
------------------
dosapp.exe > d:\results.txt
------------------
Call from VB
Shell ("d:\test.bat")
------------------
smalig
smalig@hotmail.com
http://vbcode.webhostme.com/
Mark Sreeves
Jan 23rd, 2000, 08:57 PM
No, non, nein ....
That's not what I meant!
What I wanted to do was run a VB app in a batch file outputting to stdout (the dos window) so the output could then be re-directed.
------------------
Mark Sreeves
Analyst Programmer
Mark.Sreeves@Softlab.co.uk
A BMW Group Company
DiGiTaIErRoR
Jan 23rd, 2000, 09:02 PM
in the bat file put something like:
C:\MyProg.exe, stdout(where stdout is an operation the program will keep)
then in the prog put:
appactivate "ms-dos prompt"
sendkeys "keys sent to the DOS window"
Hope this helps!
------------------
DiGiTaIErRoR
Mark Sreeves
Jan 23rd, 2000, 10:22 PM
Here is a C++ program
#include <iostream.h>
void main()
{
cout << "Hello World" << endl;
}
When compiled and executed in a DOS window, "Hello World" is displayed on the command line.
How can I do the same in VB?
------------------
Mark Sreeves
Analyst Programmer
Mark.Sreeves@Softlab.co.uk
A BMW Group Company
Clunietp
Jan 23rd, 2000, 10:35 PM
This probably won't help, but what the hell
http://www.vb-world.net/articles/console/
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.