返回顶部

收藏

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

标签:mac,网卡地址,批处理

收藏

0人收藏

支持

0

反对

0

相关聚客文章
  1. webwlan 发表 2014-02-01 13:18:09 windows2003 DHCP中批处理绑定IP与MAC
  2. 博主 发表 2014-05-13 00:00:00 mac下nginx搭配php-fpm解析php文件
  3. 博主 发表 2011-03-14 16:00:00 115URLAction -Mac下批量下载115文件
  4. Eric Slivka 发表 2015-04-16 13:53:38 Apple Partners With The Conservation Fund to Prote
  5. yourwilliam (yourwil 发表 2014-10-20 00:00:00 mac环境下安装eclipse以及相关插件
  6. Charles 发表 2014-11-17 07:34:37 brew 安装 PHP54 失败
  7. 博主 发表 2015-01-13 01:46:00 Sketch + Framer = $125,立省 $55
  8. happyeddie 发表 2015-03-31 04:08:59 Mac Yosemite下QT5.4.1发布程序在其他Mac无法运行
  9. Geeekr 发表 2014-08-29 03:35:27 在Mac上使用tree命令
  10. 博主 发表 2013-10-06 04:31:00 mac上安装octopress
  11. 山姆是个好蜀黍 发表 2014-08-04 13:18:00 Mac系统下SVN工具推荐
  12. admin 发表 2015-05-11 06:27:43 苹果IOS设备数据恢复

发表评论