Home / Software / Computer programming / Batch files - text manipulation
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: Batch files - text manipulation  (Read 2762 times)
stebie
Guest
« 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 » IP logged
Pages: [1] - (Top) Print 
Home / Software / Computer programming / Batch files - text manipulation « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.089 seconds with 18 queries.