I am new to this, so please bear with me, and if you need more information from me, please tell me. Thanks in advance for your help.
I have this code that pings on different computers and then returns if they are online / offline. I wanted to know if another column could be added as soon as the bat file did its ping test so that it had the computer name next to it.
@echo off if exist C:\tools\computers.txt goto Label1 echo. echo Cannot find C:\tools\computers.txt echo. Pause goto :eof :Label1 echo PingTest executed on %date% at %time% > C:\tools\z.txt echo ================================================= >> C:\tools\z.txt for /f %%i in (C:\tools\computers.txt) do call :Sub %%i notepad C:\tools\z.txt goto :eof :Sub echo Testing %1 set state=alive ping -n 1 %1 | find /i "bytes=" || set state=dead echo %1 is %state% >> C:\tools\z.txt
The bat file creates a document that shows the following:
PingTest on 07/28/2016 at 13:10:28
99.1.82.28 alive
99.1.82.100 alive
Ect.
If possible, I would like the bat file to be launched so that it displays this:
The bat file creates a document that shows the following:
PingTest on 07/28/2016 at 13:10:28
Computer 1: 99.1.82.28 is alive
Computer 2: 99.1.82.100 is alive
Ect.
-
Thank you for your help and guidance on this.
Thanks.
source share