标题: [文本处理] [已解决]批处理备份IP,网关和DNS为制定批处理格式,方便恢复,能实现么? [打印本页]
作者: ht512 时间: 2012-12-20 15:51 标题: [已解决]批处理备份IP,网关和DNS为制定批处理格式,方便恢复,能实现么?
本帖最后由 ht512 于 2013-4-19 12:48 编辑
备份地址到D盘- netsh interface ip dump >>d:\ ip.txt
复制代码
自动生成这种格式- netsh interface ip set address name="本地连接" source=static addr=192.168.1.2 mask=255.255.255.0
- netsh interface ip set address name="本地连接" gateway=192.168.1.1 gwmetric=0
- netsh interface ip set dns name="本地连接" source=static addr=202.103.96.68 register=PRIMARY
- netsh interface ip add dns name="本地连接" addr=202.103.96.112
- netsh interface ip set wins name="本地连接" source=static addr=none
复制代码
有没有办法实现,本人新手,望各位赐教!
作者: batman 时间: 2012-12-20 17:01
以后用来还原的批处理是ipback.bat- @echo off
- (for /f "skip=1 delims=" %%a in ('netsh interface ip dump^|findstr "本地连接"') do echo netsh interface ip %%a)>ipback.bat
复制代码
作者: ht512 时间: 2012-12-21 15:14
回复 2# batman
请问win7里面能使用么?
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |