将commnad提示输出重定向到文件 [英] Redirect commnad prompt output to file

查看:87
本文介绍了将commnad提示输出重定向到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在尝试将两个命令chkdsk和defrag的输出从命令提示符重定向到一个txt文件,例如c:>碎片整理c:> log.txt.
它的行为在Windows XP上是正常的.输出按顺序进入文件.
但是,在Windows Server 2008 R2上,chkdsk可以正常工作,但是在执行碎片整理时,在某些初始时间文件仍为空白,突然之间充满了很多文本.我希望它的顺序与Windows XP相同.
如果我们在Windows Server 2008 R2上运行defrag s exe而不进行重定向,则会在屏幕上获得顺序输出.
示例:-
情况1:直接在命令提示符下运行命令
C:>碎片整理c:
Windows磁盘碎片整理程序
版权所有(c)2007 Microsoft Corp.和Executive Software International,Inc.
.

情况2:在命令提示符下运行命令并将输出重定向到文件
C:>碎片整理c:> log.txt (在这种情况下,文件将保持空白,直到命令完成)

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?

推荐答案

使用/OUT:< Path>< filename>
use /OUT:<Path><filename>


这篇关于将commnad提示输出重定向到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆