Change gateway on windows 7 from command line

Not sure if things have changed with Windows 7 but on XP you could just do something like this.

route add 0.0.0.0 mask 0.0.0.0 192.168.0.1


netsh interface ipv4 set route 0.0.0.0/32 "Local Area Connection" 192.168.1.1 

The name of the network adapter is likely "Local Area Connection".


The command line given by Cheekaleak does not work for me, this one does:

netsh int ip set address "Local Area Connection" address=192.168.1.64 mask=255.255.255.0 gateway=192.168.1.1

You have to specify every field (address, mask and gateway). Otherwise they will be reset.


A persistent way to change the configuration:

route -p add 0.0.0.0 mask 0.0.0.0 192.168.0.1     
route -p change 0.0.0.0 mask 0.0.0.0 192.168.0.1