- for /f "tokens=2 delims=:" %%M in ('ipconfig /all^|find /i "Physical Address"') do set Mac=%%M
- echo. 本机 MAC地址 (硬件获取): %Mac%
- set PCMAC=%MAC:~1%
- echo.
- for /f "tokens=1" %%a in ('type MAC.ini^|find /i "%PCMac%"') do (set pcname=%%a)
- echo 本机计算机名 (动态获取): %pcname%
- echo.
- for /f "tokens=2" %%b in ('type MAC.ini^|find /i "%PCMac%"') do (set myip=%%b)
- echo 本机 IP 地址 (动态获取): %myip%
复制代码
|