返回顶部

收藏

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. yili1992 发表 2015-05-27 14:53:24 安装 sails 问题 Mac OS
  3. 博主 发表 2015-05-23 10:26:27 Mac上手
  4. fyc198610 发表 2015-02-09 08:17:26 Omni系列软件注册机
  5. hillock 发表 2015-05-28 10:45:16 mac上eclipse 安装 javaHL时出错
  6. 博主 发表 2015-06-15 17:02:00 MAC OS X系统显示和隐藏文件
  7. 博主 发表 2015-03-29 07:31:00 hack mac的网站( 黑苹果网站)
  8. 博主 发表 2015-06-24 06:18:07 魅族手机连接Mac的问题
  9. 郑几块 发表 2015-07-11 08:05:51 PaintCode 用户操作指南(动态图形篇)
  10. 空气 发表 2015-05-06 22:55:37 HHVM 3.3.x for Mac OS X
  11. licess 发表 2013-10-23 09:49:09 OS X 10.9 Mavericks下如何安装Command Line Tools(命令行工具)
  12. admin 发表 2015-08-13 12:19:26 Wireshark 无法在Mac下工作

发表评论