#SingleInstance force #NoTrayIcon #NoEnv LAN_Name="Wireless Network Connection" RunWait ,%comspec% /c netsh interface ip show address > tmpFile,,Hide FileRead, ipInfo, tmpFile FileDelete, tmpFile Loop, Parse, ipInfo, `n,`r %A_Space% { StringLeft, line, A_LoopField, 4 If line = Conf { StringTrimLeft, LAN, A_LoopField, 28 If (LAN = LAN_Name) match=1 } Else If !(match) continue If line = DHCP { StringRight, enabled, A_LoopField, 3 break } } If !(match) { MsgBox,16,IP Toggle, LAN Connection not found:`n%Lan_Name% ExitApp } If enabled=yes { RunWait, (LTrim Join`s %comspec% /c netsh interface ip set address Name=%LAN_Name% Source=Static Addr=192.168.1.109 Mask=255.255.255.0 Gateway=192.168.1.1 GWmetric=0 ) Run, (LTrim Join`s %comspec% /c netsh interface ip set dns Name=%LAN_Name% Source=Static Addr=192.168.1.1 ) ,,Hide } Else { RunWait, (LTrim Join`s %comspec% /c netsh interface ip set address Name=%LAN_Name% Source=DHCP ) Run, (LTrim Join`s %comspec% /c netsh interface ip set dns Name=%LAN_Name% Source=DHCP ) ,,Hide }