IsT3RiK wrote: ↑April 30th, 2022, 7:39 am
hello, someone can update the code, cause the ON /OFF works but the status dosent change
thx a lot
If by any chance your connection is a wifi one instead of an ethernet one, or other details regarding the DHCP and whether the IP is static or dynamic are different, then jsmorley code from this thread which is using these to release or renew the IP for all adapters:
will indeed not work, or better said it will only work when you're "disconnecting" via
ipconfig / release.
The solution in that case would be to either:
1) use
Predator73's resolve above (though that requires elevation in CMD, aka running it as an administrator), by running these to disable or enable your network interface (again, these will not reconnect you to the internet if your connection is wireless, just like the previously mentioned method):
Code: Select all
netsh interface set interface "YOURINTERFACE" disabled
Code: Select all
netsh interface set interface "YOURINTERFACE" enabled
2) use these to disconnect or connect to your interface and wireless SSID (assuming the security key / password is automatically used):
Code: Select all
netsh wlan disconnect interface="YOURINTERFACE"
Code: Select all
netsh wlan connect name="YOURCONNECTION" ssid="YOURSSID" interface="YOURINTERFACE"
As far as I tested the last two commands, they seem to do precisely what the user does when disconnecting or connecting manually. They don't require administrative privileges either, so that's a plus. Though I am able to connect over a wired connection as well, I didn't test them on that to see if they can represent a general solution to the problem by working in that case too, but anyone is welcomed to try (by the way, parameters are generally required only if the said parameter can have more than one valid value).
To see what values can be used for the
name,
ssid or
interface parameters / fields, these can be used (I used the same
name value as the
ssid value was and it worked for me):
To apply these in the skin, test them in CMD first to make sure whichever commands you chose work, then set the
Parameter= options in the RunCommand measures from the skin accordingly.
References:
here,
here,
here and
here.