How to Change DNS Servers Programmatically in Windows?

蓝咒 提交于 2019-12-18 17:29:43

问题


I want to change DNS servers programmatically. I don't want to build a DNS server, I just want to change the primary and secondary dns servers automatically. This work needs to be done in Python.


回答1:


You can call a command line tool to do it for you with os.system.

import os
os.system('netsh interface ip set dns "Local Area Connection" static 192.168.0.200')


来源:https://stackoverflow.com/questions/7415771/how-to-change-dns-servers-programmatically-in-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!