Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to write a script and the interface column does not display the interface!

C:\>route print
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 ff 27 13 f6 5b ...... TAP-Win32 Adapter V9
0x3 ...08 00 27 53 00 bb ...... AMD PCNET Family PCI Ethernet Adapter - Packet
cheduler Miniport
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric

I need a way to find out what interface (as in 0x1, 0x2, 0x3) that route is using. Kind of like how in *nix route will give you:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use **Iface**     *        U     202    0        0 **eth0**
default         UG    202    0        0 **eth0**

Also, no where in 'route print' does it say default, my script just assumes the first line with in it contains the default gw in the third column, is this a safe assumption?

share|improve this question
"is this a safe assumption?" Might not be. The format is right, but you might have multiple default routes. (In that case I think the route with the lowest metric is used.) – Mikel Dec 20 '10 at 22:47

Use the commands

netsh interface ipv4 show route

to see the list of routes, and

netsh interface ipv4 show interface

to see the list of interfaces.

The route always is the default route and points to the default gateway.

share|improve this answer

Your Answer


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