Netsh batch file, wont remember the gateway

0

I'm making a little batch file to change some network adapter settings:

Can anyone please explain why this works:

netsh interface ipv4 set address name="Local Area Connection" static 192.168.1.11 255.255.255.0 192.168.1.1

However this doesn't (It amends the IP, SUBNET however it makes no changes to the Gateway):

set /p FIRSTIP=Please type the IP address provided: 
set /p SUBNETIP=Please type the Subnet IP provided: 
set /p DFTGATEWAY=Please type the Gateway provided: 

netsh interface ipv4 set address name="Local Area Connection" static %FIRSTIP% %SUBNETIP% %GATEWAY%

This is on a Windows 10 machine. I've been scratching my head at this one and most KB articles seem of little help.

PKR

Posted 2018-04-17T14:09:36.737

Reputation: 3

2DFTGATEWAY is not the same variable as GATEWAY – Ben Voigt – 2018-04-17T14:12:47.573

In the future, to troubleshoot things like this you can just use ECHO ON, or put ECHO in front of the line that's causing problems – Ben Voigt – 2018-04-17T14:14:34.597

@BenVoigt how did I not noticed that!!! Thank you ever so much :) – PKR – 2018-04-17T14:16:41.127

1I'm voting to close this question as off-topic because finding a typo is unlikely to ever be interesting to future readers. – Ben Voigt – 2018-04-18T17:26:04.257

No answers