Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?

1 solution

use /OUT:<Path><filename>
Share this answer
MS_TJ 9-Jul-10 7:20am    
can u pls give example

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900