Yes, it is possible.
First you need to find the address. E.g. with
findstr /C:" IPv6 Address" foo.txt
Then you need to get the address into a variable:
set Address=
for /f "delims=: tokens=1*" %%a in ('findstr /C:" IPv6 Address" foo.txt') do (
if not defined Address=%%b
)
Note the use of %%b
there, despite the loop variable being %%a
. That's because tokenization creates new variables. Also we're only using the first address because there might be several, but that's only a vague heuristic because it's not really set in stone whether non-NIC devices come before or after them.
Then we need to clean up the address because colons are not valid in file names:
set Address=%Address::=_%
And rename the file
ren foo.txt %Address%.txt
You surely can figure out how to adapt this to IPv4 or MAC addresses, I guess.