I'm wondering how to copy a chunk of output in the command prompt in Windows 7. What I'm ultimately trying to accomplish is when I type "route print" I want to copy the IPs listed under IPv4 Route Table. I used the findstr command to grab 1 line at a time but is there a way to grab the whole table in one shot?

Thanks,

link|improve this question
feedback

4 Answers

up vote 3 down vote accepted

Ok, this is getting pretty ugly but seems to work, somehow:

route print -4 | findstr /r /c:"^  *[0-9][0-9]*\.[0-9][0-9]*\."

This yields the complete IPv4 routing table for me, excluding the interface list.

You may be better off running it through for /f, though and just count the number of lines that consist solely of = signs to know where you are in the output.

link|improve this answer
Thanks man, much appreciated. – syuusuke Apr 5 '10 at 10:45
feedback

"grab" in what sense?

Would piping the output to a file be useful? e,g.

c:\route print > test.txt

link|improve this answer
feedback

You can copy the output directly into your windows clipboard by 'piping' to 'clip'

so your command would look like this:

route print | clip

You can then paste in notepad, etc.

You can also manually copy pieces to the clipboard by right-clicking the window, selecting 'mark' then dragging across an area. While the area is highlighted, the clipboard will contain a copy of that area.

link|improve this answer
feedback

Try using powershell. You can do a lot more with that. There may be a better way to do it.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.