• 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心洋葱网用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!
  • 由于近期流量激增,小站的ECS没能经的起亲们的访问,本站依然没有盈利,如果各位看如果觉着文字不错,还请看官给小站打个赏~~~~~~~~~~~~~!

windows下如何使用批处理获得本机mac地址

实用代码 水墨上仙 2509次浏览

windows下通过批处理获得本机mac地址

@ECHO OFF
:: Check OS version
IF NOT "%OS%"=="Windows_NT" GOTO Syntax
SETLOCAL
:: Check command line arguments
IF NOT "%~2"=="" GOTO Syntax
ECHO.%1 | FINDSTR /R /C:"[/?*]" >NUL && GOTO Syntax
:: If the batch file is intended for use on
:: local computers only, remove the next line:
IF "%~1"=="" (SET Computer=%ComputerName%) ELSE (SET Computer=%~1)
:: The actual command is a one-liner, be it a long one.
:: If the batch file is intended for use on local computers only,
:: use IPCONFIG /ALL instead of NBTSTAT -a %Computer%
FOR /F "tokens=*" %%A IN ('NBTSTAT -a %Computer% 2^>NUL ^| FINDSTR /R /I /C:"[0-9A-F][0-9A-F]-*[0-9A-F][0-9A-F]-*[0-9A-F][0-9A-F]-*[0-9A-F][0-9A-F]-*[0-9A-F][0-9A-F]-*[0-9A-F][0-9A-F]"') DO FOR %%B IN (%%A) DO SET MACAddress=%%B
:: Show result and exit
ECHO MAC Addres of %Computer%: %MACAddress%
ENDLOCAL & SET MACAddress=%MACAddress%
GOTO:EOF
:Syntax
ECHO.
ECHO GetMacXP.bat,  Version 1.00 for Windows NT 4 and later
ECHO Show the MAC address for any computer in the workgroup or domain
ECHO.
ECHO Usage:  GETMACXP  [ computer ]
ECHO.
ECHO Where:  "computer" is the name of the computer we want to know the
ECHO                    MAC address of (default is the local computer)
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
IF "%OS%"=="Windows_NT" ENDLOCAL


开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明windows下如何使用批处理获得本机mac地址
喜欢 (2)
加载中……