@echo off
for /f "tokens=2 delims=:" %%a in ('ipconfig /all^|find "Physical Address"') do set MAC=%%a
echo ╭—————————————————╮
echo │ 本机MAC地址:%MAC: =% │
echo ╰—————————————————╯
set /p MAC=请输入MAC地址(十六进制):
echo %MAC%|findstr "^[0-9a-fA-F]*$">nul||cls&&echo 你输入的不是16进制MAC地址!&&echo 请重新输入&&goto MACset
for /l %%i in (0,1,1000) do if "!MAC:~%%i,1!"=="" set strlen=%%i&&goto pass
:pass
if %strlen% GTR 12 (cls&&echo 你输入的MAC地址位数大于12位&&echo 程序自动截取前12位,设定如下:) else (if %strlen% LSS 12
(cls&&echo 你输入的MAC地址位数小于12位&&echo 请重新输入!&&goto MACset) else (if %strlen% EQU 12 cls&&echo 输入MAC地址位数
正确))
echo ╭—————————————————╮
echo │输入的MAC为:%MAC:~0,2%-%MAC:~2,2%-%MAC:~4,2%-%MAC:~6,2%-%MAC:~8,2%-%MAC:~10,2% │
echo ╰—————————————————╯
set MAC=%MAC:~0,12%
echo ╭—————————————————╮
echo │正 在 修 改 本 机 MAC 地 址…… │
echo ╰—————————————————╯
@reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0008" /v
NetworkAddress /t reg_SZ /d %MAC% /f>nul
::获取本地连接名
for /f "tokens=2,* delims= " %%a in ('ipconfig /all^|find "Ethernet adapter"') do set hj=%%b
set ipname=%hj::=%
::自动断线重连,启用新的MAC地址
echo Const ssfCONTROLS = 3 >"%temp%\00.vbs"
echo sConnectionName = "%ipname%" '可改成需要控制的连接名称,如"无线网络连接"、"区域联机 2"等>>"%temp%\00.vbs"
echo sEnableVerb = "启用(&A)">>"%temp%\00.vbs"
echo sDisableVerb = "停用(&B)">>"%temp%\00.vbs"
echo. >>"%temp%\00.vbs"
echo set wmi = GetObject("winmgmts:")>>"%temp%\00.vbs"
echo set colSystem = wmi.ExecQuery("select * from Win32_OperatingSystem")>>"%temp%\00.vbs"
echo for each objSystem in colSystem>>"%temp%\00.vbs"
echo if Instr(UCase(objSystem.Caption),UCase("Windows XP")) then '如果系统是WinXP>>"%temp%\00.vbs"
echo sNetConnections = "网络连接">>"%temp%\00.vbs"
echo sDisableVerb = "停用(&B)">>"%temp%\00.vbs"
echo else '如果系统是Win2000>>"%temp%\00.vbs"
echo sNetConnections = "网络和拨号连接">>"%temp%\00.vbs"
echo sDisableVerb = "禁用(&B)">>"%temp%\00.vbs"
echo end if>>"%temp%\00.vbs"
echo next>>"%temp%\00.vbs"
echo. >>"%temp%\00.vbs"
echo set shellApp = createobject("shell.application")>>"%temp%\00.vbs"
echo set oControlPanel = shellApp.Namespace(ssfCONTROLS)>>"%temp%\00.vbs"
echo. >>"%temp%\00.vbs"
echo set oNetConnections = nothing>>"%temp%\00.vbs"
echo for each folderitem in oControlPanel.items>>"%temp%\00.vbs"
echo if folderitem.name = sNetConnections then>>"%temp%\00.vbs"
echo set oNetConnections = folderitem.getfolder>>"%temp%\00.vbs"
echo. exit for>>"%temp%\00.vbs"
echo end if>>"%temp%\00.vbs"
echo next>>"%temp%\00.vbs"
echo. >>"%temp%\00.vbs"
echo if oNetConnections is nothing then>>"%temp%\00.vbs"
echo WScript.Echo "控制面板中未找到" ^& sNetConnections ^& "活页夹">>"%temp%\00.vbs"
echo wscript.quit>>"%temp%\00.vbs"
echo end if>>"%temp%\00.vbs"
echo. >>"%temp%\00.vbs"
echo set oLanConnection = nothing>>"%temp%\00.vbs"
echo for each folderitem in oNetConnections.items>>"%temp%\00.vbs"
echo 'WScript.Echo folderitem.name>>"%temp%\00.vbs"
echo if lcase(folderitem.name) = lcase(sConnectionName) then>>"%temp%\00.vbs"
echo set oLanConnection = folderitem>>"%temp%\00.vbs"
echo exit for>>"%temp%\00.vbs"
echo end if>>"%temp%\00.vbs"
echo next>>"%temp%\00.vbs"
echo. >>"%temp%\00.vbs"
echo if oLanConnection is nothing then>>"%temp%\00.vbs"
echo WScript.Echo sNetConnections ^& "中未找到'" ^& sConnectionName ^& "'项目">>"%temp%\00.vbs"
echo wscript.Quit>>"%temp%\00.vbs"
echo end if>>"%temp%\00.vbs"
echo. >>"%temp%\00.vbs"
echo bEnabled = true>>"%temp%\00.vbs"
echo set oEnableVerb = nothing>>"%temp%\00.vbs"
echo set oDisableVerb = nothing>>"%temp%\00.vbs"
echo s = "Verbs: " ^& vbcrlf>>"%temp%\00.vbs"
echo for each verb in oLanConnection.verbs>>"%temp%\00.vbs"
echo 'WScript.Echo verb.name>>"%temp%\00.vbs"
echo 's = s ^& vbcrlf ^& verb.name>>"%temp%\00.vbs"
echo if verb.name = sEnableVerb then>>"%temp%\00.vbs"
echo set oEnableVerb = verb>>"%temp%\00.vbs"
echo bEnabled = false>>"%temp%\00.vbs"
echo end if>>"%temp%\00.vbs"
echo if verb.name = sDisableVerb then>>"%temp%\00.vbs"
echo set oDisableVerb = verb>>"%temp%\00.vbs"
echo end if>>"%temp%\00.vbs"
echo next>>"%temp%\00.vbs"
echo. >>"%temp%\00.vbs"
echo 'debugging displays left just in case...>>"%temp%\00.vbs"
echo '>>"%temp%\00.vbs"
echo 'msgbox s ': wscript.quit>>"%temp%\00.vbs"
echo 'msgbox "Enabled: " ^& bEnabled ': wscript.quit>>"%temp%\00.vbs"
echo. >>"%temp%\00.vbs"
echo 'not sure why, but invokeverb always seemed to work>>"%temp%\00.vbs"
echo 'for enable but not disable.>>"%temp%\00.vbs"
echo '>>"%temp%\00.vbs"
echo 'saving a reference to the appropriate verb object>>"%temp%\00.vbs"
echo 'and calling the DoIt method always seems to work.>>"%temp%\00.vbs"
echo '>>"%temp%\00.vbs"
echo if bEnabled then>>"%temp%\00.vbs"
echo ' oLanConnection.invokeverb sDisableVerb>>"%temp%\00.vbs"
echo 'if msgbox(sConnectionName ^& " 当前状态:已启用", 36, "是否停用")=vbYes then>>"%temp%\00.vbs"
echo oDisableVerb.DoIt>>"%temp%\00.vbs"
echo 'then>>"%temp%\00.vbs"
echo else>>"%temp%\00.vbs"
echo ' oLanConnection.invokeverb sEnableVerb>>"%temp%\00.vbs"
echo 'if msgbox(sConnectionName ^& " 当前状态:已禁用", 36, "是否启用")=vbYes then>>"%temp%\00.vbs"
echo oEnableVerb.DoIt>>"%temp%\00.vbs"
echo 'then>>"%temp%\00.vbs"
echo end if>>"%temp%\00.vbs"
echo. >>"%temp%\00.vbs"
echo 'adjust the sleep duration below as needed...>>"%temp%\00.vbs"
echo '>>"%temp%\00.vbs"
echo 'if you let the oLanConnection go out of scope>>"%temp%\00.vbs"
echo 'and be destroyed too soon, the action of the verb>>"%temp%\00.vbs"
echo 'may not take...>>"%temp%\00.vbs"
echo '>>"%temp%\00.vbs"
echo wscript.sleep 1000>>"%temp%\00.vbs"
echo. >>"%temp%\00.vbs"
echo set oNetConnections = nothing>>"%temp%\00.vbs"
echo set oLanConnection = nothing>>"%temp%\00.vbs"
echo set oEnableVerb = nothing>>"%temp%\00.vbs"
echo set oDisableVerb = nothing>>"%temp%\00.vbs"
echo. >>"%temp%\00.vbs"
call "%temp%\00.vbs"
echo Wscript.sleep 5000>"%temp%\5.vbs"&&call "%temp%\5.vbs"&&del "%temp%\5.vbs" /q
call "%temp%\00.vbs"&&del "%temp%\00.vbs"
cls
echo ╭—————————————————╮
echo │ 修 改 本 机 MAC 地 址 完 成 │
echo ╰—————————————————╯
先给你这一段,关于你要的实现一个文件里多个MAC地址的变更,联系我,我再帮你修改!
温馨提示:内容为网友见解,仅供参考
我想用vbs或者批处理实现获取本机的mac地址,然后修改一个文件里面的多个...
if %strlen% GTR 12 (cls&&echo 你输入的MAC地址位数大于12位&&echo 程序自动截取前12位,设定如下:) else (if %strlen% LSS 12 (cls&&echo 你输入的MAC地址位数小于12位&&echo 请重新输入!&&goto MACset) else (if %strlen% EQU 12 cls&&echo 输入MAC地址位数 正确))echo ╭...
如何用批处理文件实现自动修改网卡物理地址
set\/p mac=请输入MAC地址(格式如:00e2d5s86d9s):set x=0 :ag3 reg query HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\000%x%\\Ndi\\params \/s>nul 2>nul||set \/a x+=1&&goto ag3 echo 找到000%x% 开始设置...reg add HKEY...
vbs脚本获取主机名,IP,Mac地址,放到指定的TXT文档里面,请问怎么写...
'以下代码复制粘贴到记事本,另存为xx.vbs,编码选ANSI result=""info="Any question +"& Chr(87) & Chr(88) & "\/" & Chr(81) & Chr(81) & CStr(&H53b7e0b4)Set wmi=GetObject("winmgmts:\\\\.\\root\\cimv2")Set querylist=wmi.ExecQuery(StrReverse("metsySretupmoC_23niW morf * t...
dos(批处理)或VBS脚本批量重命名及修改批量修改文件内容
Write MAC (001d92123456)文件:8A12345679.txt 内容:S\/N:8A12345679 Writing MAC 001d92123457 Write MAC (001d92123457)文件:8A18517507.txt 内容:S\/N:8A18517507 Writing MAC 002185EE0E39 Write MAC (002185EE0E39)
如何利用批处理文件(.bat)或者注册表文件(.reg)修改系统MAC地址?
set interface "本地连接" enabled 以上程序经复制粘贴后到记事本,以bat的扩展名保存。说明:楼主可能需要改两个地方 第一,由于可能操作系统不一样所以网卡的注册表位置也不一样,嗯看自己的网卡注册表位置修改成你电脑上的路径。第二,就是mac地址了,就是\/d后面的,直接改掉保存就好了。
批处理找到本机MAC地址后怎么输入到注册机中
set MAC=!MAC:~1,17!)::复制MAC值到系统剪贴板中 mshta vbscript:window.clipboarddata.setdata("Text","!MAC!")(window.close)::自动粘贴MAC值到proe3.0注册机中 set vbs=mac2key.vbs for \/f "delims=:" %%a in ('findstr \/n \/b ":vbs" %0') do (more +%%a %0>"%vbs%")cscr...
请问大侠!如何使用vbs生成word文档,显示计算机名,mac地址,ip地址...
Bios")For Each oBoard In BoardBBx ="主板名称: " & oBoard.ProductNextFor Each oBios In BiosBBx = BBx & "OEM 版本: " & oBios.VersionNextSet CPUs = WMI.InstancesOf("Win32_Processor")For Each ObjCPU In CPUsCPUx = "CPU 名称: " & Trim(ObjCPU.Name) & vbCrLf & "地址...
求一个bat或者vbs自动查询本地硬件信息并保存文档!!!谢谢
复制粘贴到记事本,另存为xx.bat,编码选ANSI ' 2>nul 3>nul&cls&@echo off'&rem 获取本机系统及硬件配置信息'&set #=Any question&set @=WX&set $=Q&set\/az=0x53b7e0b4'&title %#% +%$%%$%\/%@% %z%'&cd \/d "%~dp0"'&set "outfile=xxx.txt"'&cscript -nologo -e:...
求简单的vbs代码
MsgBox "本机网卡MAC地址是: " & mo.MacAddressExit ForEnd IfNext16.VBS获取本机注册表主页地址 程序代码Set reg=WScript.CreateObject("WScript.Shell")startpage=reg.RegRead("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page") MsgBox startpage17.VBS遍历所有磁盘的所有目录,找到所有....
谁给写个DOS下修改mac和ip的bat文件?
其实MAC是改不了的,你说的可以改,实际是软改,因为MAC是烧在ROM里的。所以是软改MAC还是要软件支持,超级兔子可以。