BookmarkSubscribeRSS Feed
Abo-Zead
Calcite | Level 5

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.

1 REPLY 1
SASKiwi
PROC Star

Questions about Windows batch scripting would be better asked on a Microsoft Windows forum. The SAS Communities deals with SAS software.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 443 views
  • 0 likes
  • 2 in conversation