Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Is there a simple way of doing this via a shell command / batch ? A VBScript would also be ok.

share|improve this question

To clear all routes, use:

route -f

To clear only persistent routes, you could use

reg delete HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes /va /f
but this wouldn't remove them from the currently active routes.

share|improve this answer

Here is a cmd-script that extracts the static routes from the registry, and issues route delete commands for each of them.

This method removes them both from the stored list of persistent routes, and from the currently active routes.

@echo off
set key=HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes
for /f "tokens=1,2,3,* delims=," %%i in ('reg query %key% ^| find "REG_SZ"') do (
   route delete %%i mask %%j %%k
share|improve this answer

Your Answer


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