pipe screen output of nt cmd script to a txt file

C

capitan

Hi all. :)

I have a nt cmd script (contents listed below, watch for text wrap)

@ECHO.
@ECHO.
@ECHO.

@xcopy "%userprofile%\My Documents\*.*" l:\temp\%username%\MYDOCS\ /d /s
/Y > c:\log.txt
@echo My Documents Complete
@echo.
@echo.
@xcopy "%userprofile%\Favorites\*.*" l:\temp\%username%\IEbookmarks\ /d
/s /y > c:\log.txt
@echo IE Bookmarks Complete

and I'm having difficulty trying to pipe the screen output to a log
file. Is there anyway for me to mabey put a pipe append after the
second command for after the file is created? Thanks a bunch!
 
G

Guest

- Change this:
@xcopy "%userprofile%\Favorites\*.*" l:\temp\%username%\IEbookmarks\ /d
/s /y > c:\log.txt

- into this:
@xcopy "%userprofile%\Favorites\*.*" l:\temp\%username%\IEbookmarks\ /d
/s /y >c:\log.txt

(You've got a space between the ">" and the start of the path: "c:\log.txt"
which shouldn't be there).
 
T

Torgeir Bakken \(MVP\)

Hi,

Use >> when you want to append to the file.


And to use the terminology correct, it is called redirect and not pipe
(to pipe you use the | character, like in "type tst.txt | sort").

Regards,
Torgeir
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top