Solved

echo

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article shows how a content item can be identified directly or through translation of a navigation type. It then shows how this information can be used to create a menu for further navigation.
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now