How to retrive text from DOS window(screen)

hi,i want to copy some text from an already opened DOS like window//

I also wana check(compare) the written text in DOS window with mine, like i wana check wht is written in 2/5 cursor position in dos or a dos like window(screen),can u plz suggest some code.

i already got the code to reach that already opened window, just want code for retriving text from DOS>

thanks..

a friend