How to collect all network Hostnames , IPs and MAC addresses inside text file Using Batch scripting and Using an external file?

Amin 1 Reputation point
2021-01-16T01:31:22.537+00:00

Hi all I'm a beginner in batch scripting and I want to create a batch script to collect All needed data in one row for each workstation inside my domain into a text file using hostnames located in a text file named 'hosts.txt' by a batch scripting language
and here is my code below:

@Echo off
echo All Information >"Hosts Info.txt"
echo. >>"Hosts Info.txt"
For /f %%d in (hosts.txt) do (
echo. %%d >>"Hosts Info.txt"
getmac /s %%d /v /nh >>"Hosts Info.txt"
ping %%d |find "Ping statistics for" >>"Hosts Info.txt"
echo._______________________________ >>"Hosts Info.txt"
)
pause
exit

but it's so dummy as I don't know but a few things about the batch programming, so I'm trying to do my best and I can't deal ever with many things like ( "tokens & delims" , " ~ " , " 1% " , " find "," findstr" ) What is these things means and how we use it to get just what I want only as I want the output look like that
1- [ Hostname : IP : MAC address ]

Example for hosts.txt

host1

host2

host3

... etc.
could anyone help me, please.

Azure Batch
Azure Batch
An Azure service that provides cloud-scale job scheduling and compute management.
308 questions
{count} votes