Can I "route delete" a specific metric?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Goalie35
Posts: 2
Joined: 04 Mar 2014 10:54

Can I "route delete" a specific metric?

#1 Post by Goalie35 » 04 Mar 2014 11:05

Everytime I start my computer, I have an issue with multiple routes on the same network destination. It prevents me from accessing the internet or anything on my network.
When I go to a command prompt & enter "ipconfig", I get the following:
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 On-link 172.16.5.81 20
0.0.0.0 0.0.0.0 172.16.5.1 172.16.5.81 10

I need to delete the first item (the one with "On-link" gateway) to get my machine to work. To fix this, I type "route delete 0.0.0.0 METRIC 20". The problem is, this deletes both lines.

So, I then need to go in and type "route add 0.0.0.0 MASK 0.0.0.0 172.16.5.1 METRIC 10".

So, 2 questions....one, is there any way to specify which Metric to delete? And two, since I'm at it, does anyone know by any chance how to prevent this multiple route problem from occurring in the first place?

Thanks

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Can I "route delete" a specific metric?

#2 Post by Squashman » 04 Mar 2014 15:08

Goalie35 wrote:When I go to a command prompt & enter "ipconfig", I get the following:
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 On-link 172.16.5.81 20
0.0.0.0 0.0.0.0 172.16.5.1 172.16.5.81 10

Really. I can't say I get that output from ipconfig

Goalie35
Posts: 2
Joined: 04 Mar 2014 10:54

Re: Can I "route delete" a specific metric?

#3 Post by Goalie35 » 04 Mar 2014 15:13

Really. I can't say I get that output from ipconfig


Sorry, I meant "route print", not ipconfig

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Can I "route delete" a specific metric?

#4 Post by Squashman » 04 Mar 2014 15:16

Just from reading the help on Microsoft's site, I believe you would have to do this.

Code: Select all

route delete 0.0.0.0 mask 0.0.0.0 On-Link

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Can I "route delete" a specific metric?

#5 Post by foxidrive » 04 Mar 2014 17:04

I know bugger all about routes, but from your description you could also use this in a batch file.

Code: Select all

@echo off
route delete 0.0.0.0 METRIC 20
route add 0.0.0.0 MASK 0.0.0.0 172.16.5.1 METRIC 10



squashman's suggestion is a better way to go, just delete the route that you don't need.

Post Reply