WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

DOS

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Reading STDIN and Writing to STDOUT

Keywords: 	 STDIN STDOUT 

Question:

How do I write to standard output? In other words, just print output to the DOS window (you know, like a dir cmd that simply lists all the files to the screen). I also want to make sure it's to STANDARD output so it can be piped, redirected, etc.

I'm just a little surprised that I can't use the fileopen on the (what is it - 5?) std files. Apparently from what I've seen here, it DOES work with LPT, COM, etc. I would have thought it should have worked with the others as well.

Answer:

No way to easily write to stdout or read from stdin. But here are some workarounds for strdout/stdin.
  1. For stdin, pipe the data to a file. Then Winbatch can read the file

  2. for stdout, make sure WinBatch is started with the start /w switch. Have Winbatch write to a file. Then in the BAT file TYPE the file to move it to stdout.

  3. For interpreted/compiled:

    Look into the rtstatus() function.

    a=rtstatus()
    Message("A is",a)
    

Article ID:   W14221
Filename:   Reading Stdin and Writing to Stdout.txt
File Created: 2001:05:02:11:50:58
Last Updated: 2001:05:02:11:50:58