How can I get response from CMD

I need to get response from cmd. For example; I ping to address and I need to save result of my request.

image

How can I do that?