Python论坛  - 讨论区

标题:[python-chinese] 使用Python自动修改Windows的IP、掩码、网关和DNS

2007年06月21日 星期四 10:14

QuJinlong qujinlong123在gmail.com
星期四 六月 21 10:14:22 HKT 2007

初次学习使用Python写了一个小的实用的工具,希望能得到Python高手的指点
地址为:http://www.blogjava.net/qujinlong123/archive/2007/06/20/125434.html
注:绝对不是广告,真心希望大家给意见,以便能提高自己的Python水平

-- 
qujinlong
2007-06-21
http://www.blogjava.net/qujinlong123
-------------- 下一部分 --------------
一个HTML附件被移除...
URL: http://python.cn/pipermail/python-chinese/attachments/20070621/ad6cb0c3/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月21日 星期四 10:17

kergee!z kergee在gmail.com
星期四 六月 21 10:17:44 HKT 2007

不错

在07-6-21,QuJinlong <qujinlong123在gmail.com> 写道:
>
> 初次学习使用Python写了一个小的实用的工具,希望能得到Python高手的指点
> 地址为:http://www.blogjava.net/qujinlong123/archive/2007/06/20/125434.html
> 注:绝对不是广告,真心希望大家给意见,以便能提高自己的Python水平
>
> --
> qujinlong
> 2007-06-21
> http://www.blogjava.net/qujinlong123
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
一个HTML附件被移除...
URL: http://python.cn/pipermail/python-chinese/attachments/20070621/d8418ccc/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月21日 星期四 23:47

danielsong sjtusongyi在gmail.com
星期四 六月 21 23:47:17 HKT 2007

Æäʵwindows×Ô´øÓÐÃüÁî¿ÉÒÔ½øÐÐÍøÂçÉèÖÃ

netsh interface ip set address "Local Area Connection" static 58.*.151.*
255.255.240.0 58.*.144.1 1

netsh interface ip set dns "Local Area Connection" static 202.*.2.*primary
ÎұʼDZ¾2Í·ÅÜ,
Õâ¸ö½Å±¾Í¦¹ÜÓùþ¹þ




ÔÚ07-6-21£¬QuJinlong <qujinlong123在gmail.com> дµÀ£º
>
> ³õ´ÎѧϰʹÓÃPythonдÁËÒ»¸öСµÄʵÓõŤ¾ß£¬Ï£ÍûÄܵõ½Python¸ßÊÖµÄÖ¸µã
> µØַΪ£ºhttp://www.blogjava.net/qujinlong123/archive/2007/06/20/125434.html
> ×¢£º¾ø¶Ô²»Êǹã¸æ£¬ÕæÐÄÏ£Íû´ó¼Ò¸øÒâ¼û£¬ÒÔ±ãÄÜÌá¸ß×Ô¼ºµÄPythonˮƽ
>
> --
> qujinlong
> 2007-06-21
> http://www.blogjava.net/qujinlong123
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
Best Regrads,
DanielSong
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070621/f9a7e081/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月21日 星期四 23:57

李辉 m2lihui在163.com
星期四 六月 21 23:57:10 HKT 2007

²»´í£¬²»¹ý£¬ÒòΪһ°ã±¾±¾ÓÐÁ½¸öÍø¿¨£¬ÎÒµÄÆäÖÐÒ»¸öÊÇÎÞÏߵģ¬ËùÒÔÔÚ×¢²á±íÖÐÕÒµ½µÚÒ»¸ö¾ÍbreakÁË»¹ÊDz»ºÃµÄ£®
ÎÒÐÞ¸ÄÁËһϣº
      driverDesc = _winreg.QueryValueEx(hSubKey, 'DriverDesc')[0]

        # ¼ì²éÊÇ·ñÊÇÒÔÌ«Íø
        if lowerRange[0] == 'ethernet' and  driverDesc == 'Broadcom NetXtreme Fast Ethernet':
            #driverDesc = _winreg.QueryValueEx(hSubKey, 'DriverDesc')[0]
½«driverDesc Ö±½Ó¸Ä³ÉÏë¸ÄµÄÄǸöÍø¿¨µÄÃû×Ö
  ----- Original Message ----- 
  From: danielsong 
  To: python-chinese在lists.python.cn 
  Sent: Thursday, June 21, 2007 11:47 PM
  Subject: Re: [python-chinese]ʹÓÃPython×Ô¶¯ÐÞ¸ÄWindowsµÄIP¡¢ÑÚÂë¡¢Íø¹ØºÍDNS



  Æäʵwindows×Ô´øÓÐÃüÁî¿ÉÒÔ½øÐÐÍøÂçÉèÖÃ

  netsh interface ip set address "Local Area Connection" static 58.*.151.* 255.255.240.0 58.*.144.1 1
  netsh interface ip set dns "Local Area Connection" static 202.*.2.*primary


  ÎұʼDZ¾2Í·ÅÜ,
  Õâ¸ö½Å±¾Í¦¹ÜÓùþ¹þ



   
  ÔÚ07-6-21£¬QuJinlong <qujinlong123在gmail.com> дµÀ£º 
    ³õ´ÎѧϰʹÓÃPythonдÁËÒ»¸öСµÄʵÓõŤ¾ß£¬Ï£ÍûÄܵõ½Python¸ßÊÖµÄÖ¸µã
    µØַΪ£º http://www.blogjava.net/qujinlong123/archive/2007/06/20/125434.html
    ×¢£º¾ø¶Ô²»Êǹã¸æ£¬ÕæÐÄÏ£Íû´ó¼Ò¸øÒâ¼û£¬ÒÔ±ãÄÜÌá¸ß×Ô¼ºµÄPythonˮƽ 

    -- 
    qujinlong
    2007-06-21
    http://www.blogjava.net/qujinlong123 
    _______________________________________________
    python-chinese
    Post: send python-chinese在lists.python.cn
    Subscribe: send subscribe to python-chinese-request在lists.python.cn
    Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
    Detail Info: http://python.cn/mailman/listinfo/python-chinese




  -- 
  Best Regrads,
  DanielSong 


------------------------------------------------------------------------------


  _______________________________________________
  python-chinese
  Post: send python-chinese在lists.python.cn
  Subscribe: send subscribe to python-chinese-request在lists.python.cn
  Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
  Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070621/7de1de04/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月22日 星期五 00:35

QuJinlong qujinlong123在gmail.com
星期五 六月 22 00:35:38 HKT 2007

嗯,其实我想写一个GUI程序将机器上所有的网络适配器都列出来,然后可以选择修改网络设置
呵呵,正在加紧学习wxPython :-)

回 danielsong 老兄,我知道netsh命令也可以修改IP设置,如果图省事还可以写个cmd或者bat文件直接点击运行就可以修改好,
不过,除了能完成自动设置IP的任务外,还有一个主要的目的就是学习使用Python :)

在07-6-21,李辉 <m2lihui在163.com> 写道:
>
>  不错,不过,因为一般本本有两个网卡,我的其中一个是无线的,所以在注册表中找到第一个就break了还是不好的.
> 我修改了一下:
>       driverDesc = _winreg.QueryValueEx(hSubKey, 'DriverDesc')[0]
>
>         # 检查是否是以太网
>         if lowerRange[0] == 'ethernet' and  driverDesc == 'Broadcom
> NetXtreme Fast Ethernet':
>             #driverDesc = _winreg.QueryValueEx(hSubKey, 'DriverDesc')[0]
> 将driverDesc 直接改成想改的那个网卡的名字
>
> ----- Original Message -----
> *From:* danielsong <sjtusongyi在gmail.com>
> *To:* python-chinese在lists.python.cn
> *Sent:* Thursday, June 21, 2007 11:47 PM
> *Subject:* Re: [python-chinese]使用Python自动修改Windows的IP、掩码、网关和DNS
>
>
> 其实windows自带有命令可以进行网络设置
>
> netsh interface ip set address "Local Area Connection" static 58.*.151.*
> 255.255.240.0 58.*.144.1 1
>
> netsh interface ip set dns "Local Area Connection" static 202.*.2.*primary
> 我笔记本2头跑,
> 这个脚本挺管用哈哈
>
>
>
>
> 在07-6-21,QuJinlong <qujinlong123在gmail.com> 写道:
> >
> > 初次学习使用Python写了一个小的实用的工具,希望能得到Python高手的指点
> > 地址为: http://www.blogjava.net/qujinlong123/archive/2007/06/20/125434.html
> > 注:绝对不是广告,真心希望大家给意见,以便能提高自己的Python水平
> >
> > --
> > qujinlong
> > 2007-06-21
> > http://www.blogjava.net/qujinlong123
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
>
>
>
> --
> Best Regrads,
> DanielSong
>
> ------------------------------
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
qujinlong
http://www.blogjava.net/qujinlong123
-------------- 下一部分 --------------
一个HTML附件被移除...
URL: http://python.cn/pipermail/python-chinese/attachments/20070622/8d858722/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年06月22日 星期五 00:39

Bright Lee m2lihui在163.com
星期五 六月 22 00:39:50 HKT 2007

是啊,大家都是在学习.
我也是今天才开始用Python,以后多交流.
有什么好的IDE呢?最好是Free的.我是从VC下过来,主要想用Python写点测试脚本,即两个间相互调用
  ----- Original Message ----- 
  From: QuJinlong 
  To: python-chinese在lists.python.cn 
  Sent: Friday, June 22, 2007 12:35 AM
  Subject: Re: [python-chinese]使用Python自动修改Windows的IP、掩码、网关和DNS,增强对指定网卡名的修改


  嗯,其实我想写一个GUI程序将机器上所有的网络适配器都列出来,然后可以选择修改网络设置
  呵呵,正在加紧学习wxPython :-)

  回 danielsong 老兄,我知道netsh命令也可以修改IP设置,如果图省事还可以写个cmd或者bat文件直接点击运行就可以修改好,
  不过,除了能完成自动设置IP的任务外,还有一个主要的目的就是学习使用Python :)


  在07-6-21,李辉 <m2lihui在163.com> 写道:
    不错,不过,因为一般本本有两个网卡,我的其中一个是无线的,所以在注册表中找到第一个就break了还是不好的.
    我修改了一下:
          driverDesc = _winreg.QueryValueEx(hSubKey, 'DriverDesc')[0]

            # 检查是否是以太网
            if lowerRange[0] == 'ethernet' and  driverDesc == 'Broadcom NetXtreme Fast Ethernet':
                #driverDesc = _winreg.QueryValueEx(hSubKey, 'DriverDesc')[0]
    将driverDesc 直接改成想改的那个网卡的名字
      ----- Original Message ----- 
      From: danielsong 
      To: python-chinese在lists.python.cn 
      Sent: Thursday, June 21, 2007 11:47 PM
      Subject: Re: [python-chinese]使用Python自动修改Windows的IP、掩码、网关和DNS



      其实windows自带有命令可以进行网络设置

      netsh interface ip set address "Local Area Connection" static 58.*.151.* 255.255.240.0 58.*.144.1 1
      netsh interface ip set dns "Local Area Connection" static 202.*.2.*primary


      我笔记本2头跑,
      这个脚本挺管用哈哈



       
      在07-6-21,QuJinlong <qujinlong123在gmail.com> 写道: 
        初次学习使用Python写了一个小的实用的工具,希望能得到Python高手的指点
        地址为: http://www.blogjava.net/qujinlong123/archive/2007/06/20/125434.html
        注:绝对不是广告,真心希望大家给意见,以便能提高自己的Python水平 

        -- 
        qujinlong
        2007-06-21
        http://www.blogjava.net/qujinlong123 
        _______________________________________________
        python-chinese
        Post: send python-chinese在lists.python.cn
        Subscribe: send subscribe to python-chinese-request在lists.python.cn
        Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
        Detail Info: http://python.cn/mailman/listinfo/python-chinese




      -- 
      Best Regrads,
      DanielSong 


--------------------------------------------------------------------------


      _______________________________________________
      python-chinese
      Post: send python-chinese在lists.python.cn
      Subscribe: send subscribe to python-chinese-request在lists.python.cn
      Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
      Detail Info: http://python.cn/mailman/listinfo/python-chinese


    _______________________________________________
    python-chinese
    Post: send python-chinese在lists.python.cn 
    Subscribe: send subscribe to python-chinese-request在lists.python.cn
    Unsubscribe: send unsubscribe to   python-chinese-request在lists.python.cn
    Detail Info: http://python.cn/mailman/listinfo/python-chinese




  -- 
  qujinlong
  http://www.blogjava.net/qujinlong123 


------------------------------------------------------------------------------


  _______________________________________________
  python-chinese
  Post: send python-chinese在lists.python.cn
  Subscribe: send subscribe to python-chinese-request在lists.python.cn
  Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
  Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
一个HTML附件被移除...
URL: http://python.cn/pipermail/python-chinese/attachments/20070622/204d0746/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号