Last active
August 20, 2023 08:58
-
-
Save swarupsro/34e0cd5fc70b6fe4299f7811f2a98fee to your computer and use it in GitHub Desktop.
Mac Address Changer
This file contains hidden or 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 | |
:menu | |
cls | |
echo MAC Address Changer Menu | |
echo Swarup Saha | |
echo. | |
echo 1. Change MAC Address | |
echo 2. Reset MAC Address | |
echo 3. Exit | |
echo. | |
set /p choice=Enter your choice: | |
if "%choice%"=="1" ( | |
call :ChangeMAC | |
) else if "%choice%"=="2" ( | |
call :ResetMAC | |
) else if "%choice%"=="3" ( | |
exit | |
) else ( | |
echo Invalid choice. Please enter a valid option. | |
pause | |
goto menu | |
) | |
goto menu | |
:ChangeMAC | |
set "adapterName=Ethernet" REM Change this to your adapter name | |
set /p newMACAddress=Enter the new MAC address: | |
echo Disabling the adapter... | |
netsh interface set interface "%adapterName%" admin=disable | |
echo Changing MAC address... | |
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001" /v "NetworkAddress" /d "%newMACAddress%" /f | |
echo Enabling the adapter... | |
netsh interface set interface "%adapterName%" admin=enable | |
echo MAC address changed to %newMACAddress% for adapter %adapterName%. | |
pause | |
goto :eof | |
:ResetMAC | |
set "adapterName=Ethernet" REM Change this to your adapter name | |
echo Disabling the adapter... | |
netsh interface set interface "%adapterName%" admin=disable | |
echo Resetting MAC address... | |
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0001" /v "NetworkAddress" /f | |
echo Enabling the adapter... | |
netsh interface set interface "%adapterName%" admin=enable | |
echo MAC address reset for adapter %adapterName%. | |
pause | |
goto :eof |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
find the adapter name in
PowerShell