Created
August 20, 2023 20:24
-
-
Save uchks/7e22e9ec089abddbc7b7b367186a9cf7 to your computer and use it in GitHub Desktop.
Toggle IPv6 for things like Lilith or Debrid services.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal enabledelayedexpansion | |
fltmc > nul 2>&1 || ( | |
powershell -Command "Start-Process '%0' -Verb runas" | |
if !errorlevel! neq 0 ( | |
cls | |
echo This requires Administrative Privileges. | |
echo Right click on the script and select "Run as administrator". | |
pause | |
) | |
exit /b 2 | |
) | |
:menu | |
cls | |
for /f %%A in ('powershell -Command "(Get-NetAdapterBinding -ComponentID ms_tcpip6 | Select-Object -ExpandProperty Enabled) -contains 'True'"') do ( | |
set "ipv6status=%%A" | |
) | |
if "!ipv6status!"=="True" ( | |
set "statusString=Enabled" | |
) else ( | |
set "statusString=Disabled" | |
) | |
title IPv6: !statusString! | |
echo IPv6: !statusString! | |
echo. | |
echo 1. Toggle IPv6 | |
echo 2. Exit | |
set /p "choice=Select an option:" | |
if "!choice!"=="1" ( | |
cls | |
powershell -Command "Get-NetAdapterBinding -ComponentID 'ms_tcpip6' | ForEach-Object {if ($_.Enabled) {Disable-NetAdapterBinding -ComponentID 'ms_tcpip6' -InterfaceAlias $_.Name} else {Enable-NetAdapterBinding -ComponentID 'ms_tcpip6' -InterfaceAlias $_.Name}}" | |
if "!ipv6status!"=="True" ( | |
echo IPv6 has been disabled. | |
set "ipv6status=False" | |
) else ( | |
echo IPv6 has been enabled. | |
set "ipv6status=True" | |
) | |
pause | |
goto :menu | |
) else if "!choice!"=="2" ( | |
exit | |
) else ( | |
echo Invalid choice. Please select a valid option. | |
goto :menu | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment