1

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,

syuusuke
  • 93
  • 8

5 Answers5

3

"grab" in what sense?

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

c:\route print > test.txt

Rob Moir
  • 31,664
  • 6
  • 58
  • 86
3

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.

Chris Thorpe
  • 9,903
  • 22
  • 32
3

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.

Joey
  • 1,823
  • 11
  • 13
1

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

JohnyV
  • 938
  • 4
  • 26
  • 45
-1

c:>route print > rprint.txt

c:>notepad rprint.txt

AEGIS
  • 21
  • 1
  • 4