Computing.Net > Forums > Programming > Batch Log File Help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch Log File Help

Reply to Message Icon

Name: Zero
Date: November 11, 2008 at 10:11:47 Pacific
OS: WinXP Pro 32Bit
CPU/Ram: Intel Core 2 Duo
Comment:

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




Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: November 11, 2008 at 13:08:16 Pacific
Reply:

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


0

Response Number 2
Name: Zero
Date: November 11, 2008 at 14:23:46 Pacific
Reply:

That works Perfectly!

Thanks for your help


0

Response Number 3
Name: Holla
Date: November 11, 2008 at 23:30:14 Pacific
Reply:

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.


0

Response Number 4
Name: klint
Date: November 12, 2008 at 01:53:47 Pacific
Reply:

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.)


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch Log File Help

Batch file help needed www.computing.net/answers/programming/batch-file-help-needed/13589.html

qbasic zip log files program help www.computing.net/answers/programming/qbasic-zip-log-files-program-help/12511.html

Log file from Batch File www.computing.net/answers/programming/log-file-from-batch-file/15308.html