Software > Computer programming

Batch files - text manipulation

(1/1)

stebie:
Hey,

I was hoping if someone could help me with the following.

I'm trying to get output from IPCONFIG, the Ethernet adapter names that are currently enabled, and have them stored in a variable for later use.

I've been able to come up with the following:

FOR /f "TOKENS=3* DELIMS=: " %%a IN ('ipconfig ^| FIND "Ethernet adapter"') DO ECHO %%a %%b

echo.

pause

This will return something like the following:

VMware Network Adapter VMnet8:
VMware Network Adapter VMnet1:
Local Area Connection:

My requirement is to have each without the colon at the end, all within double-quotes and all stored within a variable.

The expected output is:

%LANS%="VMware Network Adapter VMnet8"*"VMware Network Adapter VMnet1"*"Local Area Connection"

or similar. Here, I've used * as the common delimiter/tokenizer.

Does anyone have any ideas that this can be achieved?

Thanks

- stebie

Navigation

[0] Message Index

Go to full version