How to display the first N lines of a command output in Windows? (the equivalent of Unix command "head")

view story

http://serverfault.com – I need to display the first N lines of the output of a command (any command). In other words, I esentially want an equivalent of the Unix "head" command. After discovering a few tricks from some other user (sorry don't remember who it was), I came up with this: tasklist | find /N " " | findstr /r \[[0-9]\] In the example above, the command processor display the first 10 lines of the tasklist command output. The command: find /N " " adds the line number at the beginning of each line. The command: findstr /r \[[0-9]\] extracts the first 10 lines using a regular expression. Now, I wou (HowTos)