ip生成器 禁止修改ip地址批处理理

Win批处理开机自动设置IP地址
  @echo off  REM select=1,网卡IP将被设置成172.16.200.34,select=2,网卡IP将被设置成192.168.0.5  ping -n 2 192.168.0.254 && set select=2 || set select=1  REM 获取网卡名称  for /f &skip=4 tokens=3* delims= & %%i in ('ipconfig') do (  set adapter=%%i  goto out  )  :out  set adapter=%adapter::=%  if %select%==1 (  netsh int ip set address name=&%adapter%& static 172.16.200.34 255.255.255.0 172.16.200.1 1  netsh int ip set
name=&%adapter%& static 202.102.224.68 primary  netsh int ip add dns name=&%adapter%& 202.102.227.68 index=2  ) else (  netsh int ip set address name=&%adapter%& static 192.168.0.5 255.255.255.0 192.168.0.254 1  )  echo 设置完成,按任意键退出!  pause &nul 2&nul
最新资讯离线随时看
聊天吐槽赢奖品
相关软件:
大小:405KB
授权:免费
大小:62.41 MB
授权:免费IP网段批量生成
import java.util.StringT
public class T {
public T() {
String s1= "10.1.2.0";
String s2=
"10.20.1.0";
String temp=
int i=0,j=0;
int[] s1array = new
int[] s2array = new int[4];
boolean isexisted =
int[] tmp = new
String ipseg =
boolean bb =
StringTokenizer st1 = new
StringTokenizer(s1,".");
while(st1.hasMoreElements())
temp=st1.nextElement().toString();
if(temp.length()&3
temp.length()==0)//其中一段长度大于3或者等于0,则bb=false,表示非法
if((s1array[i-1]=Integer.parseInt(temp))&255)
bb=//值大于255,非法//
System.out.println(i);
StringTokenizer st2 = new
StringTokenizer(s2,".");
while(st2.hasMoreElements())
temp=st2.nextElement().toString();
if(temp.length()&3
temp.length()==0)
if((s2array[j-1]=Integer.parseInt(temp))&255)
System.out.println(j);
if(s1array[0]&s2array[0])
//检查开始网段是否比结束网段大
if(s1array[0]==s2array[0])
if(s1array[1]&s2array[1])
if(s1array[1]==s2array[1])
if(s1array[2]&s2array[2])
if(s1array[2]==s2array[2])
if(s1array[3]&s2array[3])
if(!bb||i!=4||j!=4)
System.out.println("输入非法");
{//合法输入
= s1array[0];
tmp[1] = s1array[1];
tmp[2] = s1array[2];
while(true)
ipseg=Integer.toString(tmp[0])+"."+Integer.toString(tmp[1])+"."+Integer.toString(tmp[2])+".0";
System.out.println(ipseg);
if(tmp[0]==s2array[0])
{ if(tmp[1]==s2array[1])
tmp[2]==s2array[2])
if(tmp[2]==256)
tmp[2]=0;tmp[1]++;
if(tmp[2]==256)
if(tmp[1]==256){
tmp[1]=0;tmp[0]++;
public static void main(String[]
没有更多推荐了,
不良信息举报
举报内容:
IP网段批量生成
举报原因:
原文地址:
原因补充:
最多只允许输入30个字
加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!博客分类:
===================================================
@echo offtitle 懒人有懒福--IP自动设置
MODE con: COLS=80 lines=30color 0a:mainclsecho 有些人就是这么懒,哈哈...echo.echo
要把IP设置为公司用的IP 请按 1echo
要把IP设置为自动获取 请按 2echo
要退出 请按 3echo.@rem 上一句是空一行set /p choice=
您的选择:echo.if "%choice%"=="1" goto ip1if "%choice%"=="2" goto ip2if "%choice%"=="3" goto endif "%choice%"=="4" goto testgoto main:ip1echo
IP自动设置开始....echo.echo
正在设置IP及子网掩码netsh interface ip set address name="本地连接" source=static addr=192.168.0.12 mask=255.255.255.0@rem 以上这句是设置IP为192.168.0.12 子网掩码为255.255.255.0echo
正在设置网关地址netsh interface ip set address name="本地连接" gateway=192.168.0.254 gwmetric=0@rem 以上这句为设置网关为192.168.0.254echo
正在设置DNS服务器netsh interface ip set dns name="本地连接" source=static addr=211.97.64.129 register=PRIMARY@rem 以上这句为设置DNS为211.97.64.129echo
设置完成echo.echo
Powered By echo
CHOICE /C YN /M "退出请按 Y,返回菜单请按 N。" if errorlevel 2 goto mainif errorlevel 1 goto end :ip2echo
IP自动设置开始....echo.echo
自动获取IP地址....netsh interface ip set address name = "本地连接" source = dhcpecho
自动获取DNS服务器....netsh interface ip set dns name = "本地连接" source = dhcp @rem 设置自动获取IPecho
设置完成echo.
Powered By echo
CHOICE /C YN /M "退出请按 Y,返回菜单请按 N。" if errorlevel 2 goto mainif errorlevel 1 goto end :testnetsh interface ip set address name = "本地连接" source = dhcpnetsh interface ip set dns name = "本地连接" source = dhcp netsh interface ip set wins name = "本地连接" source = dhcp CHOICE /C YN /M "退出请按 Y,返回菜单请按 N。" if errorlevel 2 goto mainif errorlevel 1 goto end :end
@echo offnet start remoteregistrynetsh interface ip set address name="本地连接" source=dhcpnetsh interface ip set dns name="本地连接" source=dhcpnet stop remoteregistryipconfig /flushdnsexit
设定固定IP
@echo offnet start remoteregistrynetsh interface ip set address name="本地连接" source=static addr=192.168.0.117 mask=255.255.255.0 gateway=192.168.0.1 gwmetric=autonetsh interface ip set dns name="本地连接" source=static addr=192.168.0.1
register=primarynetsh interface ip add dns name="本地连接" addr=192.168.0.2
index=2net stop remoteregistryipconfig /flushdnsexit
* 参数说明: 1. name:网络连接名称,一般为“本地连接”。你可以在“控制面板”-&“网络连接”中看到。 2. source:获取IP的途径。动态获取,则为dhcp,手动设置,则为static。 3. addr:要设置的IP地址。 4. mask:子网掩码。 5. gateway:网关地址。 6. gwmetric:网关跃点数,可以设置为整型数值,也可以设置为“自动”:auto。 7. index:设置的DNS的顺序号。 知道了如何设置IP和DNS后,你可以自己编写一个BAT文件: 1. 新建一个文本文档,将后缀改为“.bat”; 2. 编辑“.bat”文件的内容为上面的设置命令3. 运行时,双击这个bat文件,等待设置完成即可。 4. 关于netsh命令的详细使用说明,可以在命令行,输入 netsh /? 命令查看
浏览: 101313 次
来自: 深圳
博主你好,,这个python文件我看了下,正好我需要的一个工具 ...
fhj2050 写道真正的一键从SVN导出已经修改过的文件,可 ...
真正的一键从SVN导出已经修改过的文件,可以参考下http:/ ...
很好,正需要这样的一个工具,谢谢博主分享!
很实用专门登录支持一下。。。
(window.slotbydup=window.slotbydup || []).push({
id: '4773203',
container: s,
size: '200,200',
display: 'inlay-fix'一键批量ping任意ip段的存活主机_电脑技术_菲菲博客
一键批量ping任意ip段的存活主机
21:14 | 浏览 2830 次
(原创文章版权所有,如需转载请注明原文链接!)
猜你还想看
Copyright & 2010 - 2017 菲菲博客网. All Rights Reserved
冀公网安备99号博客访问: 757874
博文数量: 250
博客积分: 6860
博客等级: 准将
技术积分: 2688
注册时间:
认证徽章:
分类: 系统运维 08:39:10
公司网络和家里网络不一样,每天回家要改一次IP,来公司要改一次IP ,很是麻烦,故整理了小批处理命令,自动来修改IP。
将以下内容保存到为bat格式就可以了。
@echo offecho.echo 修改ip地址,1为自动获取ip地址,2为修改家里ip地址,3 为公司IPecho.set sel=set/p sel=请选择修改方式:if "%sel%"=="1" goto autoif "%sel%"=="2" goto homeif "%sel%"=="3" goto companyecho 您没有选择修改方式。goto end
:autonetsh interface ip set address name="本地连接" source=dhcpnetsh interface ip delete dns "本地连接" allipconfig /flushdnsipconfig /allgoto end
:homeecho 正在更改IP地址,请稍等......netsh interface ip set address name="本地连接" source=static addr=192.168.1.80 mask=255.255.255.0 gateway=192.168.1.1 gwmetric=1netsh interface ip set dns name="本地连接" source=static addr=202.102.192.68netsh interface ip add dns name="本地连接" addr=202.102.199.68 index=2& ipconfig /flushdnsipconfig /allecho 更改IP地址完成!goto end
:companyecho 正在更改IP地址,请稍等......netsh interface ip set address name="本地连接" source=static addr=10.85.10.80 mask=255.255.255.0 gateway=10.85.10.253 gwmetric=1netsh interface ip set dns name="本地连接" source=static addr=218.104.78.2netsh interface ip add dns name="本地连接" addr=10.85.7.100 index=2& ipconfig /flushdnsipconfig /allgoto end
阅读(1912) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
请登录后评论。}

我要回帖

更多关于 批处理ping多个ip 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信