Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Python3 controls win10 connection wifi hotspots

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

I. basic knowledge

Introduction to 1.netsh:

Netsh (Network Shell) is a powerful command line tool for network configuration provided by the windows system itself. Netsh supports the following instructions:

This article mainly describes how to connect a new wifi (which can be a local area network or a public network) through the netsh command. Connecting to the local area network is mainly considered to facilitate the use of python to control the computer to connect the wifi module, and then you can play more applications, such as testing the performance of the WIFI module, completing the upgrade control of the equipment through the computer, and so on.

II. Operation steps

1. Create a user profile

(1) View the configuration files that exist on the current computer

Netsh wlan show profiles

(2) Export existing configuration files

Netsh wlan export profile key=clear

(3) modify the new configuration file

Now you need to connect to a new hotspot. Ssid is router_test and the password is 12345678.

You need to copy a file from the configuration file exported above and change the name to WLAN-router_test. The contents of the file are as follows:

two。 Add profile

Netsh wlan add profile filename=WLAN-router_test.xml

3. Connection test

Netsh wlan connect name=router_test

4.python connection testing

Python can call os.system () to execute system commands

# encoding = utf-8import osos.system ("netsh wlan connect name=router_test")

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report