|
我试了N多方法
echo off
echo --------------------
echo.
echo 设置IP地址......
echo.
echo. 注:如果不是使用Win2003的ifmon.dll,禁用与启用网卡命令无效。
echo.
echo ---------------------------------------------------------------
echo.
SET /P ST= 请输入末节点:
echo.
@echo on
@rem 关闭动态IP服务
net stop dhcp
@rem --------------------------------------------------------------------------
@rem 在 Windows XP Embedded 中使用 Netsh 的条件。
@rem 如果您不使用 Explorer Shell,则可能会发现接口默认情况下未命名。
@rem Explorer 会自动命名它们,因此只要 explorer.exe 已经运行,就不会遇到该问题。
@rem 作为显式运行 explorer.exe 的替代方法,
@rem 可以通过在命令提示处键入以下内容,手动调用函数 HrRenameConnection
@rem --------------------------------------------------------------------------
@rem 注:上面的描述就是打开控制面板,再打开网络连接,可以使用netsh命令了。
@rem ------------------------------------------------------------------------------------------------------
rundll32 netshell.dll HrRenameConnection
@rem 使用接口IP上下文
netsh add helper ifmon.dll
@rem ----------------------------------------------------------------------------
@rem 由于使用了关闭动态IP服务的办法来加快设置IP的速度,因此注释了下面禁用网卡命令
@rem netsh interface set interface name="本地连接" admin=DISABLED
@rem ----------------------------------------------------------------------------
@rem 设置静态IP,网关,默认DNS服务器,可自行修改。
@rem 注:第一遍网关不能设置成功,未知原因
@rem ---------------------------------------------------------------
netsh interface ip set address "本地连接" static addr=192.168.1."%ST%" mask=255.255.255.0 gateway=192.168.1.1 auto
netsh interface ip set address "本地连接" static addr=192.168.1."%ST%" mask=255.255.255.0 gateway=192.168.1.1 auto
netsh interface ip set dns "本地连接" static 192.168.1.1
@rem --------------------------------------------------------------------
@rem -----------------------------------------------------------------------------------------------------------------
@rem 由于使用了关闭动态IP服务的办法来加快设置IP的速度,因此注释了下面启用网卡命令
@rem echo. netsh interface set interface name="本地连接" admin=enable
@rem ---------------------------------------------------------------------------------------------
@rem 启动动态IP服务
net start dhcp
netsh interface ip set address "本地连接" static addr=192.168.1."%ST%"
SET /P ST= 请输入末节点:
net stop dhcp
rundll32 netshell.dll HrRenameConnection
netsh add helper ifmon.dll
netsh interface ip set address "本地连接" static addr=192.168.36.88 mask=255.255.255.0 gateway=192.168.36.22 auto
netsh interface ip set address "本地连接" static addr=192.168.36.88 mask=255.255.255.0 gateway=192.168.36.22 auto
netsh interface ip set dns "本地连接" static 202.101.98.54net
netsh interface ip add dns "本地连接" 202.101.98.55net
start dhcp
始终不能自动在 PE 中设置IP,高手来看看到底是啥问题. |
|