Link to home
Create AccountLog in
Avatar of Lonelygirl_2012
Lonelygirl_2012

asked on

batch echo output twice

Hi Experts,


I'm not quite sure why the arp command outputs twice. Also, I want the "arp" output with "Padding" 50 spaces counting from the first. Could you please review and assist?

echo | set /p= LAN1 MAC Address : 3C-EC-EF-B9-46-46           : & arp -a | find /i "3C-EC-EF-B9-46-46"

Open in new window

Result: 

LAN1 MAC Address ; 3C-EC-EF-B9-46-46           :   192.168.1.40          3c-ec-ef-b9-46-46     dynamic
  192.168.1.40          3c-ec-ef-b9-46-46     dynamic

Open in new window

Best regards,

LG

ASKER CERTIFIED SOLUTION
Avatar of Alex [***Alex140181***]
Alex [***Alex140181***]
Flag of Germany image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Lonelygirl_2012
Lonelygirl_2012

ASKER

Hi Alex,
I combined the "ARP" command line to the echo. It is a batch script running from CMD Terminal of Windows OS. Not from Linux OS.
Best regards,
LG
My goal is to obtain an IP of an known MAC address. The result as shown. But somehow, the arp result output twice..
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Hi Experts,
My purpose is that I want to have  a message that "My LAN1 MAC... then the result of it in one line".. and sorry for the confusion.
Best regards
LG
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account

Hi all Experts (Alex, Qlemo, bbao),


If I have missed anyone, please accept my apologies. Sorry for the question was a bit of confusion to all. But I'm very satisfied with the support you all provided. 

for /F "tokens=1,2 delims= " %A in ('arp -a ^| find /i "...MAC Address..." ') do echo LAN1 MAC Address : %B   %A 

Open in new window

Best regards,

LG

SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account