[fpc-pascal] How to list IP and MAC of network adapters on Windows?

Bo Berglund bo.berglund at gmail.com
Fri Sep 10 14:02:42 CEST 2021


On Fri, 10 Sep 2021 09:46:11 +0200, Sven Barth via fpc-pascal
<fpc-pascal at lists.freepascal.org> wrote:

>You can use the ipconfig command and parse its output (especially ipconfig
>/all).

I also figured that to be the case, so I will run TProcess with Ipconfig /all
and then parse the result line by line.

It looks like there is a simple system to it:

Adapter headings start at pos 1 on a line.
   Data within the adapter start on pos 4 on each line

And the adapter name starts directly after the word "adapter " on the heading
line.

Data for this adapter follow until the next adapter starts.

Should be easy enough to parse out.

Thanks!

-- 
Bo Berglund
Developer in Sweden



More information about the fpc-pascal mailing list