is it possible to connect a Windows 10 PC to a WiFi using a batch script?

I need to connect my Windows 10 PC to a WiFi automatically to test the WEP-128 encryption mode in a router. Basically, when I change the encryption mode in the router, I need to connect the PC to its SSID (I know the WEP-128 key). Do you guys know if I can do this from the cmd so I can write a batch script? Python could be good too!


Solution 1:

Yes, it is possible. You need to have the wireless profile established, meaning you have to have that connection previously setup and saved. Once you connect the first time to YOURSSID, you will be able to use netsh to connect to it at any desired moment.

You then can connect with: netsh wlan connect ssid=YOURSSID name=YOURPROFILENAME

You can list profiles using netsh wlan show profile

You can disconnect from the session using netsh wlan disconnect