• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 595
  • Last Modified:

echo

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
shadow2007
Asked:
shadow2007
  • 2
1 Solution
 
knightEknightCommented:
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
 
knightEknightCommented:
oops, left out an exit:

@echo off

call :log test text

exit/b


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

:end
0
 
rwskasCommented:
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
 
shadow2007Author Commented:
sweet
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now