Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Need a little help please...
I've created a backup script and log file no problem. However, I wish for my log file to display the files being copied in the command window as well as be written to the log file.
for example:
xcopy "C:\test" "D:\test" /h /e /y /f /i /v >> log.txt
Now I've just tried putting con on the end with no success, like so:
xcopy "C:\test" "D:\test" /h /e /y /f /i /v >> log.txt >> CON
any suggestions?
Thanks in Advance

If you just want to log what xcopy is taking in account, you have to code xcopy twice, the first time with the /l switch and the other as usual. The /l switch just lists the files to be transferred without actually copying them.
xcopy "C:\test" "D:\test" /h /e /y /f /i /v /l >> log.txt
xcopy "C:\test" "D:\test" /h /e /y /f /i /v

Talking about redirecting outputs to multiple destinations, TCC LE from jpsoft does it.
(free cmd.exe replacement).klint, are you reading?
There is a command called "tee".
TEE
Purpose: Copy standard input to both standard output and a file.Format: TEE [/A /D /T] file...
file One or more files that will receive the "tee-d" output.
/A(ppend) /T(ime)
/D(ate)
See also: Y, piping and redirection.
Usage:
TEE is normally used to "split" the output of a program so that you can see it on the display and also save it in a file. It can also be used to capture intermediate output before the data is altered by another program or command.
TEE gets its input from standard input (usually the piped output of another command or program), and sends out two copies: one to standard output, the other to the file(s) that you specify. TEE is not likely to be useful with programs which do not use standard output, because these programs cannot send output through a pipe.
For example, to search the file DOC for any lines containing the string Take Command, make a copy of the matching lines in TC.DAT, sort the lines, and write them to the output file TCS.DAT:
ffind /t"Take Command" doc | tee tc.dat | sort > tcs.dat
If you are typing at the keyboard to produce the input for TEE, you must enter a Ctrl-Z to terminate the input.
See Piping for more information on pipes.
Option:
/A Append to the file(s) rather than overwriting them.
/D Prefix each line with the current date (in yyyy-mm-dd format).
/T Prefix each line with the current time (in hh:mm:ss.ms format).
--
Holla.

Hi Holla, yes I saw that. In fact, I'm already using a version of tee: one I got from the GNU tools for Windows. (I also use many more GNU tools, such as grep, awk, sed, head, tail, etc.)

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |