Solved

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

Posted on 2011-03-15
6
362 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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
LVL 78

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

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

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

Note: This is the second blog post in a series on email clearinghouses (https://www.xmatters.com/alert-management/blog-email-has-failed-us?utm_campaign=70138000000ydLoAAI&utm_source=exex&utm_medium=article&utm_content=blog-post).   Every month t…
There’s a movement in Information Technology (IT), and while it’s hard to define, it is gaining momentum. Some call it “stream-lined IT;” others call it “thin-model IT.”
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

734 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