Is there an stdbuf equivalent for Windows 7 command prompt?

一世执手 提交于 2020-01-04 03:25:14

问题


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.

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).

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


回答1:


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 

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



来源:https://stackoverflow.com/questions/13317375/is-there-an-stdbuf-equivalent-for-windows-7-command-prompt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!