I occasionally search commands in the command history by typing something like:
Code: Select all
doskey /history | findstring SOMEPROGRAM
Code: Select all
@echo off
doskey /history
Likewise, 'history | more' outputs nothing.
Yet 'history >NUL' and 'history >temp.txt' work well as expected.
Stranger still, instead of a batch file, I tried using a doskey macro: (Let's make it eat its own dog food )
Code: Select all
doskey hist=doskey /history
But this time, it's 'hist >NUL' that does not work: The doskey output still appears on the screen, despite the >NUL redirection.
Likewise, 'hist | more' does not work: 100 lines scroll through without pause.
So obviously doskey writes to stdout in some cases, and not in others.
My laptop runs Windows 10.
Any ideas as to why all this happens, and how to avoid it?