Solved append the o/p and write the o/p of cmd to different files.

August 24, 2012 at 07:31:53
Specs: Windows 7
Hi,

I need to append the output of a comand to a file and write the same output to a different file.

Ex:

c:\> dir

I need to append the output of this command to append.txt and write the output to write.txt. I need to do this using a single command.

c:/> dir >> append.txt
c:/> dir > write.txt


See More: append the o/p and write the o/p of cmd to different files.

Report •


#1
August 24, 2012 at 08:24:02
✔ Best Answer
Well, you're asking in the Win2K3 forum, but list your system as Win7. If you're using Windows 7 and you're using PowerShell, you can use the Tee-Object.

If you're using Win2K3 and batch, you'll need to download and possibly install a Win32 port of tee.

If you can't use third party tools, you can make a version of tee with VBScript.

If you have an irrational hatred of Window's native scripting language, you'll be forced to append the output file to the other.

dir > write.txt
type write.txt >> append.txt

How To Ask Questions The Smart Way


Report •
Related Solutions


Ask Question