1

Can anyone help me?i have tried it in many ways but i was unsuccessful. i tried setting a variable p and increasing the value of p by ping command and displaying value of new p.

@echo off
set p = 0
%p% = ping -n 10 8.8.8.8 | find /c "TTL=" 
echo p = %p%
pause
  • Batch is sensitive to spaces in a `SET` statement. `SET FLAG = N` sets a variable named "FLAG*Space*" to a value of "*Space*N" The syntax `SET "var=value"` (where value may be empty) is used to ensure that any stray trailing spaces are NOT included in the value assigned. Nevertheless, you need to use a `for /f` to assign values in this manner, or send the output to a file and read it with a `set/p.. – Magoo Apr 12 '17 at 06:48

0 Answers0