windows - How to add a count to the end of a bat file -


i'm using following ping list of computers text file (shown below)

i'm wondering if there way add count end of this. ie there 20 ok machines , 50 failed.

@echo off   /f "usebackq delims=" %%# in ( "location of .txt file" ) (     echo+     echo [+] pinging: %%#      ping -n 1 "%%#" 1>nul && (         echo     [ok]) || (         echo     [failed])  )>>results.txt  pause&exit 

@echo off     setlocal enableextensions disabledelayedexpansion      set "up=0"     set "down=0"  (     /f "usebackq delims=" %%# in ( "location of .txt file"     ) (         echo+         echo [+] pinging: %%#          ping -n 1 "%%#" 1>nul && (             set /a "up+=1"   & echo     [ok]) || (             set /a "down+=1" & echo     [failed])      )      setlocal enabledelayedexpansion     echo   : !up!     echo down : !down!     endlocal  )>>results.txt  pause&exit 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -