Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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,

share|improve this question

5 Answers 5

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.

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

c:>route print > rprint.txt

c:>notepad rprint.txt

share|improve this answer
    
This is technically correct, but the downvote is probably for the brevity. (It wasn't me.) –  Katherine Villyard Apr 8 at 17:43

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.

share|improve this answer

"grab" in what sense?

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

c:\route print > test.txt

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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