STDOUT to env var

Apr 28, 2012
1
0
#1
As an example under cmd.exe I used the following hack to get an IP address for a computer:

ping %1 | findstr Pinging | sed "s/^.*\[\(.*\)\].*$/\1/" | set /p IPADDRESS=

what is the easiest equivalent?

I'm currently using:

ping %1 | findstr Pinging | sed "s/^.*\[\(.*\)\].*$/\1/" >%TEMP%\ip
set /p IPA=<%TEMP%\ip
del /q %TEMP%\ip

but would prefer not to use a temporary file.