Solved

echo

Posted on 2011-03-16
4
582 Views
Last Modified: 2012-06-21
I am trying to, in batch script, echo to screen and file is this possible with just one statement or it has to be

echo test
echo test>>file.txt
0
Comment
Question by:shadow2007
[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
  • 2
4 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 35149321
You can create a sub to do that ... I call it "log" below, and call it with a test message:


@echo off

call :log test text

:log
echo %*
echo %* >> file.txt
exit/b

:end
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 500 total points
ID: 35149330
oops, left out an exit:

@echo off

call :log test text

exit/b


:log
echo %*
echo %* >> file.txt
exit/b

:end
0
 
LVL 6

Expert Comment

by:rwskas
ID: 35150115
There is no single command in batch to echo to the screen and to a file.

I noticed you tagged powershell, in which case you could use the Tee-Object command
0
 

Author Closing Comment

by:shadow2007
ID: 35150633
sweet
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
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…

696 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