Microsoft DOS route command

Quick links

About route

About route

Command to manually configure the routes in the routing table.


The route.exe command is an external command that is available in the below Microsoft operating systems.

Windows 95
Windows 98
Windows ME
Windows 2000
Windows XP
Windows Vista
Windows 7


ROUTE [-f] [-p] [command [destination] [MASK netmask] [gateway] [METRIC metric] [IF interface]

-f Clears the routing tables of all gateway entries. If this is used in conjunction with one of the commands, the tables are cleared prior to running the command.
-p When used with the ADD command, makes a route persistent across boots of the system. By default, routes are not preserved when the system is restarted. When used with the PRINT command, displays the list of registered persistent routes. Ignored for all other commands, which always affect the appropriate persistent routes. This option is not supported Windows'95. command
command One of these:

PRINT Prints a route
ADD Adds a route
DELETE Deletes a route
CHANGE Modifies an existing route destination

destination Specifies the host.
MASK Specifies that the next parameter is the 'netmask' value.
netmask Specifies a subnet mask value for this route entry.  If not specified, it defaults to
gateway Specifies gateway.
interface the interface number for the specified route.
METRIC Specifies the metric, ie. cost for the destination.

All symbolic names used for destination are looked up in the network database file NETWORKS. The symbolic names for gateway are looked up in the host name database file HOSTS.

If the command is PRINT or DELETE. Destination or gateway can be a wildcard, (wildcard is specified as a star '*'), or the gateway argument may be omitted.

If Dest contains a * or ?, it is treated as a shell pattern, and only matching destination routes are printed. The '*' matches any string, and '?' matches any one char. Examples: 157.*.1, 157.*, 127.*, *224*.

Diagnostic Notes:
Invalid MASK generates an error, that is when (DEST & MASK) != DEST.
Example> route ADD MASK IF 1
The route addition failed: The specified mask parameter is invalid.
(Destination & Mask) != Destination.



> route PRINT

>route ADD

IF 2

If IF is not given, it tries to find the best interface for a given

> route PRINT
> route PRINT 157* .... Only prints those matching 157*
> route DELETE
> route PRINT

One way to use this would be as follows: You can't ping the server that you are connecting to, but you know the ip address to be

>route PRINT

Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 14 a4 c3 44 20 ...... Xircom CardBus Ethernet 10/100 Adapter
0x3 ...00 b0 d0 43 55 a5 ...... 3Com EtherLink PCI
0x4 ...00 01 b0 8f 8f 80 ...... NdisWan Adapter

Active Routes:
Network Destination Netmask Gateway Interface Metric 1 1 1 1 2 1 1 1 1 1

** notice that no gateway for the current ip goes to, so it must be added. Now do the below command.

>route ADD MASK <your current ip from winntcfg or winipcfg> METRIC 1

**Then do the below command:

>route print

Active Routes:
Network Destination Netmask Gateway Interface Metric 1 1 1
** 1 1 2 1 1 1 1 1

**Notice the ** ip address gives me the default gateway.

Additional information

  • See our gateway, ip address, and route definitions for further information and related links on these terms.