Windows 7命令提示符是否有与stdbuf等效的文件? [英] Is there an stdbuf equivalent for Windows 7 command prompt?

查看:290
本文介绍了Windows 7命令提示符是否有与stdbuf等效的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此gnu具有stdbuf,它允许您修改命令的I/O流的缓冲.我需要命令提示符具有相同的功能,但似乎找不到任何相关信息.

So gnu has stdbuf which allows you to modify buffering of a command's I/O stream. I need the same functionality for command prompt but I can't seem to find anything about it.

我只是试图将程序的stdout和stderr都输出到日志文件中,而不进行缓冲(或者,只是为了使它们同步并以与控制台中显示的顺序相同的方式).

I'm simply trying to output both stdout and stderr of a program, to a logfile, without buffering (or rather, just so that they are in sync and in the same order they would be displayed as in the console).

我只是错过了一些明显的命令或语法,还是在Windows中运气不好?

Did I just miss some obvious command or syntax, or am I just out of luck in windows?

推荐答案

看看

Take a look at this. I don't have Windows to test on, but my guess is that you would need something like this:

.\foo.bat > .\bar.log 2>&1 

这将默认为缓冲的IO,这不是您想要的,但未缓冲的输出

This will default to buffered IO, which is not exactly what you want, but unbuffered output does not seem to be possible.

这篇关于Windows 7命令提示符是否有与stdbuf等效的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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