为什么我不能将PRINT的输出重定向到控制台?

时间:2015-04-23 04:57:16

标签: batch-file

此:

@echo ###########>printable.txt
@print /d:con  printable.txt 1>nul 2>nul

始终向控制台生成输出:

###########
♀

无论输出如何重定向.Pipe to MORE或FINDSTR都无济于事。

是否可以将PRINT重定向到控制台?

1 个答案:

答案 0 :(得分:2)

Redirection works only with stdin, stdout, and stderr file streams. A pipe works exclusively via stdout.

You can direct PRINT to write to the console device, causing the output to appear on the screen. But that is not going through stdout or stderr, so it does not do any good.

PRINT writes directly to a device, not to stdout or stderr. So I don't think there is any way to do what you want.