I have all the details to connect to a particular access point. I have to use that access point only, so all I require is the command to do it.
I solve the problem by this:
adb pull /data/misc/wifi/wpa_supplicant.conf ~/Desktop,and then edit the file, add network module, my whole conf file is:
##### wpa_supplicant configuration file template #####
update_config=1
ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=wifi
eapol_version=1
ap_scan=1
fast_reauth=1
network={
ssid="your ssid"
psk="your pswd"
key_mgmt=WPA-PSK
priority=241
}
Then rm the origin file, add push it to /data/misc/wifi folder, reboot your device.Please note, different device has different content above the network line,don't modify that part.