Solved

How can I echo all the console text to a log file while still displaying onscreen?

Posted on 2011-03-15
6
363 Views
Last Modified: 2012-05-11
I am looking for a way to fun a command from the command prompt and have all the output saved to a file.  But I do not want to supress the console display.  I want to see what is going on, but alos have a record of it for later.

Currently using a UNC to get to the executable:
C:\>\\Server\Share\Tools\updates\QC-updater.exe >>c:\temp\QC-updater.log 2>&1

It logs everything to a file, but won't display it on screen as well.

Thanks in advance!

Ed
0
Comment
Question by:ednetman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 8

Expert Comment

by:ragnarok89
ID: 35141966
The only way I know is with 2 statements:

echo off
echo This is going to the screen.
@echo this is goinh to the log>>log.txt
0
 
LVL 85

Expert Comment

by:oBdA
ID: 35142274
You can do that with tee.exe, for example with the version included in the GNU utilities here:
GNU utilities for Win32
http://unxutils.sourceforge.net/

You just pipe the output of the command to tee.exe and tell tee.exe the file to write too.
If tee.exe file is in the same folder as the program above (-a appends to the file, default is to overwrite it):
\\Server\Share\Tools\updates\QC-updater.exe 2>&1 | \\Server\Share\Tools\updates\tee.exe -a C:\temp\QC-updater.log
0
 
LVL 7

Author Comment

by:ednetman
ID: 35142863
Hmm, Tee seems like a good option, but it's not going to be on the machines.  It would take time to allow that file to be on the server that houses the update executable, if it dever got approved.

I was hoping for something more command line based that is internal to the OS.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 79

Accepted Solution

by:
arnold earned 250 total points
ID: 35144017
write to the file as you have and use tail -f to tail the file. Tail I think is part of the support tools or resource kit.
i.e.
open one command windows and run:
tail -f c:\temp\QC-updater.log
In another window run:
\\Server\Share\Tools\updates\QC-updater.exe >>c:\temp\QC-updater.log 2>&1
0
 
LVL 7

Author Comment

by:ednetman
ID: 35172513
I checked the desktops and file is not there. It is on the server, so I am going to try running it from there.
0
 
LVL 7

Author Comment

by:ednetman
ID: 35231817
Ok, I think that got it.  I see that tail has to be run in a seperate windows fromt eh actual commands, but I think I can work with that.
also, the log file has to exist BEFORE running tail.exe.  Again, no worries there.
I was able to run it from a network share with a mapped drive.  I need to test with a UNC, but if that doesn't work I can simply map a drive and disconnect when done.

This is pretty darn close to what I needed, and I think I can work with this.

Thanks for the help!

~Ed
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Postmortem reporting allow us to examine mistakes in a way that focuses on the situational aspects of a failure’s mechanism and the decision-making process of individuals proximate to the failure. Read our guide on how to handle IT post-mortem repor…
Popular third-party chat platforms like Slack, Discord, and Telegram are just a few of the many new productivity applications that are being hijacked by cybercriminals to create command-and-control (C&C) communications infrastructures for their malw…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question