2014-06-06 5 views
0

이 질문에 대한 답변을 많이 찾았지만 배치는 아닙니다. 여기 있습니다.IP 주소를 Mac 주소로 변환하십시오. cmd

C:\Users\Colton>arp -a 

Interface: 192.168.1.12 --- 0xb 
    Internet Address  Physical Address  Type 
    192.168.1.1   74-44-01-42-aa-df  dynamic 
    192.168.1.11   20-7c-8f-3f-03-9b  dynamic 
    192.168.1.255   ff-ff-ff-ff-ff-ff  static 
    224.0.0.22   01-00-5e-00-00-16  static 
    224.0.0.252   01-00-5e-00-00-fc  static 
    224.0.0.253   01-00-5e-00-00-fd  static 
    239.255.255.250  01-00-5e-7f-ff-fa  static 
    255.255.255.255  ff-ff-ff-ff-ff-ff  static 

그 자체만으로는 givin IP 주소의 Mac 주소를 가져와야합니다. findstr 명령이 필요한 것 같지만 사용 방법을 모른다.

for /f "delims=" %%A in ('command_that_I_need') do set "macaddress=%%A" 
echo the mac address of 192.168.1.11 is %mac%. 

나는 그게 내가해야 할 일은 한, ARP 명령의 맥 주소를 구문 분석하는 방법을 아무 생각이 :

나는 다음이 명령을 변수로하는 것이 설정합니다.

답변

1
set "ip=192.168.1.11" 
for /f "tokens=2" %%a in ('arp -a ^| findstr /b /l /c:" %ip% "') do set "mac=%%a" 
echo %ip% = %mac% 
관련 문제