Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch files - text manipulation  (Read 12325 times)

0 Members and 1 Guest are viewing this topic.

stebie

  • Guest
Batch files - text manipulation
« on: May 19, 2004, 09:18:21 AM »
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
« Last Edit: May 19, 2004, 09:49:56 AM by stebie »