@echo off: -----------------------------: by root_119atmsn.com :----------- ---- ipconfig ------ SET Connect = Local connection set address = 192.168.1.177set netmask = 255.255.255.0.com Gateway = 192.168.1.1.1.2 DNS2 = 192.168.1.2: --- ----------------------------
IF not defined TMP (Echo variables error %% TMP %% & goto end) if exist% TMP% / setaddress DEL% TMP% / setaddress || (echo can't deltree% TMP% / setaddress & goto end) Echo Pushd Interface IP>% TMP% / setaddress || (echo can't write in% TMP% / setaddress & goto end) echo set address name = "% connection%" source = static addr =% address% mask =% netmask% >> % TMP% / setaddressecho set address name = "% connection%" GATEWAY =% GATEWAY% GWMETRIC = 1 >>% TMP% / setaddressecho set DNS name = "% connection%" Source = static addr =% DNS1% >>% TMP % / setaddressecho add dns name = "% connection%" Addr =% DNS2% >>% TMP% / setaddressecho set wins name = "% connection%" source = static addr = none >>% TMP% / setaddressecho popd >>% TMP% / setaddressif NOT% systemroot% / system32 / netsh.exe (echo not find netsh.exe & goto end) @% systemroot% / system32 / netsh.exe -f% TMP% / setaddress @ del% TMP% / setaddress / Qif Errorlevel 1 Echo Error! & goto overhecho config ip company!: End cmd / k exit