Lan-Connection on/off

These small buttons quickly enable or disable your desired lan-adapter using Windows built-in netsh command (e.g. if you don't want an application connect to internet):

Within code replace NAME_OF_LAN_ADAPTER to yours.

Enable:

@runmode hide netsh interface set interface NAME_OF_LAN_ADAPTER enabled

Disable:

@runmode hide netsh interface set interface NAME_OF_LAN_ADAPTER disabled

1 Like

Nice. Don't forget to add the @admin modifier, or it won't work.

For convenience, here's the code to paste onto the toolbar. Modify as needed.

<?xml version="1.0"?>
<button backcol="none" display="icon" separate="yes" textcol="none" type="three_button">
	<label>Toggle LAN Connection</label>
	<icon1>#ftpconnect</icon1>
	<button backcol="none" display="both" textcol="none">
		<label>Enable LAN</label>
		<icon1>#mapnetworkdrive</icon1>
		<function type="normal">
			<instruction>@admin</instruction>
			<instruction>@runmode:hide</instruction>
			<instruction>netsh interface set interface LAN enabled</instruction>
		</function>
	</button>
	<button backcol="none" display="both" textcol="none">
		<label>Disable LAN</label>
		<icon1>#disconnectnetworkdrive</icon1>
		<function type="normal">
			<instruction>@admin</instruction>
			<instruction>@runmode:hide</instruction>
			<instruction>netsh interface set interface LAN disabled</instruction>
		</function>
	</button>
</button>

Yes, but only necessary when you aren't admin.

You can also add another adapter in the commandline (e.g. when you have ethernet and wifi).