Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

STDOUT to env var

Apr
1
0
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.
 
If you used the full TCC, you'd have the variable function @IPADDRESS. Alternately, you can do this:
ping %1 > clip: %+ set IPADDRESS=%@word[2,%@clip[2]]

If %1 is jpsoft.com, this will set IPADDRESS to [141.101.125.120]

NOT TESTED IN TCC/LE!
 
Back
Top