Results 1 to 6 of 6

Thread: VB in a DOS Batch file

  1. #1

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    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

    [email protected]
    A BMW Group Company

  2. #2
    Addicted Member
    Join Date
    Oct 1999
    Posts
    232

    Post

    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
    [email protected]
    http://vbcode.webhostme.com/


  3. #3

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    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

    [email protected]
    A BMW Group Company

  4. #4
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    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:
    Code:
    appactivate "ms-dos prompt"
    sendkeys "keys sent to the DOS window"
    Hope this helps!

    ------------------
    DiGiTaIErRoR

  5. #5

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    Here is a C++ program

    Code:
    #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

    [email protected]
    A BMW Group Company

  6. #6
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    This probably won't help, but what the hell
    http://www.vb-world.net/articles/console/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width