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.

Displaying the results of winbatch script at DOS command line

Keywords: 

Question:

I am running NT4.0 and at times I would like to write winbatch scripts to perform various admin task, however I would like the results dispalyed at the command line not in a GUI window. Can WinBatch display at the DOS command line?

Answer:

No, but here is a workaround to display text in a dos window. It doesn't save it, but you see it on the screen:
  1. at the dos prompt type
         echo {alt-195}>-.com
    
    This will make a 3-byte file called -.com put this file on your path! Note that this must be done in a dos box, and {alt-195} is to hold down the alt key and press the number 195 on the numberic keypad.

  2. Using Command.com. You need to set the command.com shortcut (or a copy of it that you run instead of command.com (and its a PIF file - look at it in DOS)) to "CLOSE WINDOW ON EXIT" and "RUN AS A WINDOW".
    	; assume Dos window called "MS-DOS"
    	RunShell("command.com","","c:\",@NORMAL,@NOWAIT)
    	SendKeysTo("MS-DOS","echo off~")
    	SendKeysTo("MS-DOS","cls~")
    
    	; then for each message you want to send to the screen, 
    	msg = "message to send to the screen"
    	SendKeysTo("MS-DOS","- %msg%~")
    
    	; when done the job
    	SendKeysTo("MS-DOS","exit~")
    	; to close the Dos box
    
    The trick is to send each line to the command line, but as parameters to the -.com file. Each line shows up with a "- " before it, a small price to pay. -.com is simply the assembly code "return" function, a 1-byte code.

Article ID:   W12880
Filename:   Display Results in a DOS Command Window.txt
File Created: 1999:04:15:16:50:16
Last Updated: 1999:04:15:16:50:16