如何创建更改我的MAC地址的批处理文件? [英] How can I create a batch file that changes my MAC address?

查看:138
本文介绍了如何创建更改我的MAC地址的批处理文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于

I recently learned how to change my MAC address thanks to https://superuser.com/questions/1514745/how-to-change-mac-address-on-windows-10-without-third-party-software/1544773 but I was wondering if I could implement this in a batch file. The registry key for my NIC is HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0011. I want to create a batch file that randomizes my MAC Address. You don't need to create the batch file for me (you can, I can't control you), but pointers would be really appreciated.

预先感谢

亚洲

推荐答案

这是我的代码,我之前已经做过.

Here is my code, I've done this before.

@echo off
dism >nul
if %errorlevel% NEQ 0 goto Elevate
(call )
netsh interface set interface Wi-Fi disable
timeout /t 1 /nobreak >null
netsh interface set interface Wi-Fi enable
choice /c RC /m "Would you like to randomize your MAC adress or customize it?"
if %Errorlevel% EQU 2 goto custom
set loopcount=5
:loop
set /a loopcount=loopcount-1
if %loopcount% LEQ 0 (goto exitloop)
set /a "ascii = %random% * 26 / 32768 + 65"
cmd /c exit /b %ascii%
set "rl1=%rl1%%=ExitCodeAscii%
goto loop
:exitloop
set MAC="0E%random:~0,2%%rl1:~0,2%%random:~0,2%%rl1:~3,2%%rl1:~-1%%random:~0,1%"
goto after
:custom
echo What would you like to change your MAC address to?
echo Remember to always have the second digit of your MAC address to always be a 2, 6, A, or E
echo Format: AABBCCDDEEFF
echo/
set /p MAC="Input your MAC address here (no spaces or hyphens)> "
:after
reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\0011" /v NetworkAddress /d %MAC% /f >null
netsh interface set interface Wi-Fi disable
timeout /t 1 /nobreak >null
netsh interface set interface Wi-Fi enable
echo Operation Successful
echo %mac% is your new MAC address
pause
goto :eof
:Elevate
Echo Error: The requested operation requires elevation
Echo Run file again as admin
Echo Closing file in 10 seconds...
timeout /t 10 /nobreak >nul
goto :eof

有时它需要重新启动才能正常工作,但通常可以正常工作.

It sometimes requires a restart before doing it to work but it usually works fine.

这篇关于如何创建更改我的MAC地址的批处理文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆