Can I get the IP address from an known MAC address of my remote PC via Batch file

Posted on 2010-01-01
Last Modified: 2013-12-23
Please help me with the error I have made .. and please advice (show) me how can I write a batch file that allow me to obtain the IP address from an known MAC address of my remote PC via Batch file. Thank you very much..


set RemotePC_0001=My_PC

ping -n 1 "%RemotePC_0001%"

arp -a "%RemotePC_0001%                                                    <================= Mistake ?

:: arp -a                                                       <=================== It will work ..

nbtstat -a %RemotePC_0001%

PAUSE Please enter to continue ...


Pinging My_PC [] with 32 bytes of data:

Reply from bytes=32 time=38ms TTL=128

Ping statistics for
    Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 38ms, Maximum = 38ms, Average = 38ms

ARP: bad argument: My_PC                                <============================= Error !!!

Wireless Network Connection:
Node IpAddress: [] Scope Id: []

    NetBIOS Remote Machine Name Table

    Name               Type         Status
    XPS-PC             <00>  UNIQUE      Registered
    THA0001            <00>  GROUP       Registered
    XPS-PC             <20>  UNIQUE      Registered
    THAM0001         <1E>  GROUP      Registered
    THAM0001        <1D>  UNIQUE      Registered
    MSBROWSE__.<01>  GROUP       Registered

    MAC Address = 00-19-0D-30-50-09

Press any key to continue . . .
Question by:cunoc
    LVL 47

    Accepted Solution

    LVL 67

    Assisted Solution

    arp needs the IP address to work with. You can retrieve the IP address by many means, one of them is to use the ping answer:

    set PCs=My_PC Your_PC
    for %%P in (%PCs%) do for /F "tokens=2 delims=[]" %%A in ('ping -n 1 %%P') do (
      if not "%%A" == "" arp -a %%A
      REM and so on

    Author Closing Comment

    Hi Qlemo and dstewartjr:

    Thank you very much for your quick responses and your answers are exactly what I am looking for ...

    HAPPY NEW YEAR YOU TWO .. (Qlemo and dstewartjr)

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    The Need In an Active Directory enviroment, the PDC emulator provide time synchronization for the domain. This is important since Active Directory uses Kerberos for authentication.  By default, if the time difference between systems is off by more …
    Many of us in IT utilize a combination of roaming profiles and folder redirection to ensure user information carries over from one workstation to another; in my environment, it was to enable virtualization without needing a separate desktop for each…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now