快速更改IP的批處理文件

来源:互联网 发布:nginx rtmp分布存储 编辑:程序博客网 时间:2024/05/22 14:54

from http://bbs.yicong.com/dispbbs.asp?boardid=6&id=982

快速更改IP的批處理文件

程序代码:

@echo off
rem eth //eth 为网卡名称,可在网络链接中查询,如"本地链接"
set eth="Local Area Connection"

rem ip //ip 为你想更改的IP
set ip=192.168.0.50

rem gw //gw 为网关地址
set gw=192.168.0.1

rem netmasks //netmasks 为子网掩码
set netmasks=255.255.255.0

echo Change IP Address t %ip%

rem
if %gw%==none netsh interface ip set address %eth% static %ip% %netmasks% %gw% > nul
if not %gw%==none netsh interface ip set address %eth% static %ip% %netmasks% %gw% 1 > nul

echo.
echo Check Current IP Address:
ipconfig
echo.
close
@echo off
rem eth //eth 为网卡名称,可在网络链接中查询,如"本地链接"
set eth="Local Area Connection"

rem ip //ip 为你想更改的IP
set ip=192.168.0.50

rem gw //gw 为网关地址
set gw=192.168.0.1

rem netmasks //netmasks 为子网掩码
set netmasks=255.255.255.0

echo Change IP Address t %ip%

rem
if %gw%==none netsh interface ip set address %eth% static %ip% %netmasks% %gw% > nul
if not %gw%==none netsh interface ip set address %eth% static %ip% %netmasks% %gw% 1 > nul

echo.
echo Check Current IP Address:
ipconfig
echo.
close

原创粉丝点击