Solved

echo

Posted on 2011-03-16
4
559 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
  • 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
Set OWA language and time zone in Exchange for individuals, all users or per database.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

831 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