How to change MAC address with batch file in Windows 7?

I want to change with a simple click (using a batch file) the MAC address of my wireless device. How do i do this? He must choose a random MAC address.

+4
source share
6 answers

I'm not sure if this is absolutely correct, but it will be something like:

In the .reg file

REGEDIT4 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0009] "NetworkAddress"="000011112222" 

0009 will have to change according to the address that you use for your adapter.

+4
source

Run the following command from a batch file:

 reg add HKLM SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001] /v NetworkAddress /d 0123456789AB 

Replace 0001 your interface number and 0123456789AB with the desired network addresses.

+4
source

Here is a specific batch file for changing the MAC address in Windows 7: Like the (misleading) title of this question, it skips the random part (on the left as an exercise to replace set / p with a generator label call). Now convenient, with all this denial of service ...

 :: Change MAC script by bobdynlan, release 1 :: For each network adapter it will list RegPath, GUID, Name, previous modified MAC if exists :: Then you can input new MAC, clear previous MAC by inputting 0 or skip by pressing [Enter] :: You can paste directly from ipconfig or wireshark because : < > { } [ ] - ( ) . will be filtered out :: Note that for wireless in Win7 standard drivers has to start with 02... 06... 0A... 0E... @ECHO OFF &SET /A RLINE=1 &SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION FOR /F "tokens=3*" %%I IN ('REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards" /S^|FINDSTR /I /L "REG_SZ"') DO ( SET /A RLINE+=1 &SET /A PARITY=!RLINE!^%%2 IF !PARITY! EQU 0 (SET "ADAPTERGUID=%%I") ELSE ( SET "ADAPTERNAME=%%I %%J" FOR /F %%A IN ('REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}" /F "!ADAPTERGUID!" /D /E /S ^|FINDSTR /I /L /V "Linkage"^|FINDSTR /I /L "\\Class\\"') DO SET "REGPATH=%%A" CLS &echo Change MAC script by bobdynlan, release 1 &echo. &echo RegPath = !REGPATH! &echo GUID = !ADAPTERGUID! &echo Adapter name = !ADAPTERNAME! REG QUERY "!REGPATH!" /V "NetworkAddress" 2>&1 |FINDSTR /I /L "NetworkAddress" SET "CHANGEMAC=" &SET "RESETMAC=" echo. &echo Enter MAC address for this adapter [0 to reset it] or press [Enter] to skip: &SET /P "CHANGEMAC=" IF "!CHANGEMAC!"=="0" (SET "RESETMAC=Y" &SET "CHANGEMAC=") ELSE SET "RESETMAC=" IF DEFINED CHANGEMAC SET "CHANGEMAC=!CHANGEMAC: =!" &FOR %%I IN (: ^< ^> { } [ ] - ^( ^) .) DO SET "CHANGEMAC=!CHANGEMAC:%%I=!" IF DEFINED CHANGEMAC REG ADD "!REGPATH!" /F /V NetworkAddress /T REG_SZ /D !CHANGEMAC! >nul 2>&1 IF DEFINED RESETMAC REG DELETE "!REGPATH!" /F /V NetworkAddress >nul 2>&1 )) IF DEFINED CHANGEMAC FOR /F "tokens=2,4*" %%I IN ('netsh interface show interface^|FINDSTR /I /L "Enabled"') DO ( netsh interface set interface %%J DISABLED netsh interface set interface %%J ENABLED ) 

ChangeMAC.bat

+3
source

There is a file changeMac.bat.

 @echo off netsh interface set interface "Local Area Connection" disable reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0007 /v NetworkAddress /d 002622D90EFC /f netsh interface set interface "Local Area Connection" enable echo Ok, enjoy it :) 

You can change three places: Local Area Connection , 0007 , 002622D90EFC . Note : you must open regedit to find out that you must change the argument 0007 . The Mac address has some rules: the second bit must be one of the following numbers: 0 2 6 A E.

There is RecoveryMac.bat that you may need.

 @echo off netsh interface set interface "Local Area Connection" disable reg delete HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0007 /v NetworkAddress /f netsh interface set interface "Local Area Connection" enable echo Ok,enjoy it :) 
+2
source
0
source

Source: https://habr.com/ru/post/1389584/


All Articles