# batch file programming-setting variables with ping replies



## bf_prg-bgnr (Jun 23, 2013)

hi guys!

i have this code:

ping -n 1 00.00.000.00 | find "Reply" >> icms_ping_log.txt

i want to put the result of "reply" into a variable instead of a text file.

how would i go about doing that or is there documentation that i can read that would help me with this?

thanks in advance for your assistance!!


----------



## FordGT90Concept (Jun 23, 2013)

I think %a% would put the value in "a" variable.

Tutorial here: http://www.tech-recipes.com/rx/630/using-variables-in-windows-batch-files/


----------



## W1zzard (Jun 23, 2013)

```
(
set /p foo=
)<icmp_ping_log.txt
```

puts the first line of the text file into variable foo

the set line can be repeated to read multiple lines into multiple variables


----------



## Mindweaver (Jun 23, 2013)

To get the result of W1zzard's set variable you would use _%foo%_


----------

