Computing.Net > Forums > Disk Operating System > how to redirect to screen and file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

how to redirect to screen and file

Reply to Message Icon

Name: vamsi
Date: March 31, 2003 at 17:54:58 Pacific
OS: windows 2000
CPU/Ram: 512
Comment:

How can we display the out put in a batch file to screen as well as to a file. I tried the following command but didn't work.

temp.bat >out 2>&1

But this is creating the out file but is not displaying on the screen simultaniously



Sponsored Link
Ads by Google

Response Number 1
Name: FishMonger
Date: March 31, 2003 at 19:32:05 Pacific
Reply:

This may not be the best method, but it works. Edit your batch file to direct its output to a file then as the last line of the batch file have it type out the text file. here's an example.

@echo off
cls
ping -a 4.2.2.2 > ping-dns.txt
type ping-dns.txt


0

Response Number 2
Name: DTec
Date: March 31, 2003 at 19:32:51 Pacific
Reply:

Put the redirect symbol inside the batch file. For example, to redirect a directory listing to an output file and to screen using a batch file called LISTDIR.BAT, the contents of the BAT file would include the following:

DIR > LISTING.OUT
DIR



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: how to redirect to screen and file

Send info to screen and log file www.computing.net/answers/dos/send-info-to-screen-and-log-file/9374.html

How to create a log file in 1 line www.computing.net/answers/dos/how-to-create-a-log-file-in-1-line/12735.html

how to transfer files b/w two computers www.computing.net/answers/dos/how-to-transfer-files-bw-two-computers-/6104.html