Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

echo

Posted on 2011-03-16
4
Medium Priority
?
594 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
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ā€¦
Loops Section Overview

971 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