How to programmatically enable/disable network interfaces? (Windows XP)

前端 未结 7 1971
一生所求
一生所求 2020-12-02 19:23

I need to enable/disable completely network interfaces from a script in Windows XP. I\'m looking for a python solution, but any general way (eg WMI, some command-line à la n

7条回答
  •  温柔的废话
    2020-12-02 20:20

    I can't seem to find any basic API for controlling interfaces on MSDN, apart from the RAS API's, but I don't think they apply to non-dialup connections. As you suggest yourself, netsh might be an option, supposedly it also has a programmatic interface: http://msdn.microsoft.com/en-us/library/ms708353(VS.85).aspx

    If you want to be pure Python, you can perhaps open a set of pipes to communicate with an netsh process.

提交回复
热议问题