views:

14

answers:

1

Hi all, I am trying to redirect the output of two commands chkdsk and defrag from command prompt to one txt file like c:> defrag c: >log.txt. Its behavior is normal on windows xp. The output is coming sequential into the file. However on Windows Server 2008 R2 chkdsk works fine but when execute defrag then for some initial time file remains blank and suddenly it fills with bunch of text. I want it sequential in the same way as Windows XP. If we run defrag s exe on windows Server 2008 R2 without redirection then we get sequential output on screen. Example: - Case 1: Directly run the command on command prompt C:>defrag c: Windows Disk Defragmenter Copyright (c) 2007 Microsoft Corp. and Executive Software International, Inc.

Case 2: Run the command on command prompt and redirect the output to a file C:>defrag c: >log.txt (In this case file remain blank until the command is completed)

What can I do so that it comes sequential into the file?

A: 

Does it behave the same way if you use an output-redirection program like tee? There's a Windows version available in the GNU utilities for Win32. If you run the program with a command like defrag c: | tee log.txt, does the output stream behave like you wish (piece-by-piece instead of buffered)?

ewall

related questions