2018年10月28日 星期日

公司、家裡IP切換

準備2個bat檔,
用記事本另存成 .bat副檔名即可.
company.bat在公司時用,
home.bat在家裡用,
以下REM後面為註解.

**company.bat**
REM example--> set IP
REM interface=區域連線 / IP=172.30.3.8 / submask=255.255.255.0 / gateway=172.30.3.1
netsh interface ipv4 set address name="區域連線" static 172.30.3.8 255.255.255.0 172.30.3.1
REM example--> set DNS
REM Primary DNS=8.8.8.8 / Secondary DNS = 8.8.4.4
netsh interface ipv4 set dns name="區域連線" static 8.8.8.8
netsh interface ipv4 add dns name="區域連線" 8.8.4.4 index=2

**home.bat**
netsh interface ipv4 set address name="區域連線" source=dhcp
netsh interface ipv4 set dnsservers name="區域連線" source=dhcp

例一:一次完成執行ip,wins,dns(2個)設定
netsh interface ip set address "區域連線" static 192.168.1.3 255.255.255.0 192.168.1.254 1
netsh interface ip set wins "區域連線" static 168.95.1.3
netsh interface ip set dns "區域連線" static 168.95.1.1
netsh interface ip add dns "區域連線" 168.95.1.5
例二:設定dns及wins
echo dns設定
netsh interface ip set dns "區域連線" static 185.110.131.43
netsh interface ip add dns "區域連線" 185.23.131.44
echo wins設定
netsh interface ip set wins "區域連線" static 185.110.131.43
pause
例三:ip(dhcp)
netsh interface ip set address "區域連線" dhcp
pause
例四:刪除dns
netsh interface ip delete dns "區域連線" all
pause
例五:刪除wins
netsh interface ip delete wins "區域連線" 185.110.131.43
pause

沒有留言:

張貼留言