|ok, just checked back here and i have actually solved this problem already, but come up against another.|
Problem was solved by:
For /F "Skip=5 Tokens=*" %%I in ('ping %serv% -n 1') do echo %%I>>host.txt
set /P ip=<host.txt
%ip4% is therefore equal to "172.168.0." for example
But my next problem comes, from a loop and trying to define a variable.
For /L %%x In (1,1,255) Do (
ping -n 1 %ip4%%%x | find /i "bytes=" > nul
if ErrorLevel 1 (echo %ip4%%%x is off-line) else (
For /F "Skip=1 Tokens=*" %%K in ('ping -a %ip4%%%x -n 1') do echo %%K>>ip.txt
set /P host=<ip.txt
This will run fine untill
at which point i dont seem to be able to set the variable host2.
Any ideas anyone?