NOTE: The following is only guaranteed to work with nmcli v1.22 (because that's what version I have), the latest is probably very similar but, in my case there's a random
-- required; it is in the documentation specified for that command. Check your version with
nmcli -v then check the specific documentation here >>Network Manager (after you click your version click the nmcli link)
I.e., for Version 1.2
nmcli con add con-name "&%TEST%&" type wifi ifname mlan0 ssid "&%SSIDNAME%&" -- wifi-sec.key-mgmt wpa-psk wifi-sec.psk "&%PASSPHRASE%&" ipv4.method manual ipv4.address 192.168.1.51/16 ipv4.dns 184.108.40.206,220.127.116.11 ipv4.gateway 192.168.1.1
nmcli con up "&%TEST%&"
However, it may be more wise to ignore the con-name because you can have multiple connections with the same name. (Luckily
nmcli con delete "&%TEST%& deletes all of those at once!)
You could use the uuid instead.
find it by
nmcli con show
then connect using
nmcli con up uuid 1c86c960-8533-11e7-bb31-be2e44b06b34
(*your uuid will not be the same...)