I have just recently(in the past 24 hours) started learning how to create batch files that will help automate some tedious tasks.
The point of this project is to be able to check connectivity on multiple computers at a specific site without having to manually ping each computer
I am trying to figure out how to make a batch file that will do the following.
Ask the user "Which Site Are You Working On?
User enters the site id
Ask the user "Which computers do you want to ping?"
User enters the computer number(this is the tricky part)
- the user will be entering 2 or more dns suffixes
- how will they separate the dns suffix? with spaces or commas?(111,222 or 111 222) or will the line have to break after each dns suffix is entered. If so how will it know when the user is done?
Display the ping results for each dns name
NOTE: the entire DNS name will be something like 123tmnpc111. The tmnpc part will always be the same, only the prefix and suffix will vary
So when the pings are performed it will need to be something like
ping %siteid%tmnpc%pcid1% -n 1 -w 2000
ping %siteid%tmnpc%pcid2% -n 1 -w 2000
ping %siteid%tmnpc%pcid3% -n 1 -w 2000
This is something simple i tested with when pinging just one DNS name. But I have no idea how to make this work for multiple(and variable) DNS names.
@echo off
echo Which Site Are You Working On?
echo/
set /p siteid=">> "
echo/
echo Which Computers Do You Want To Ping?
echo/
set /p pcid=">> "
echo/
cls
ping %siteid%pc%pcid% -n 1 -w 2000
pause > nul
If anyone could point me in the right direction it would be greatly appreciated. Thank you