Link to home
Start Free TrialLog in
Avatar of lloydie-t
lloydie-t

asked on

How command results into stringlist.

I want to be able to read the results of a windows command into a stringlist. The following command:
getmac /v /fo csv | findstr Local
 
produces following results:
"Local Area Connection","Realtek RTL8102e Family PCI-E Fast Ethernet NIC (NDIS 6.0)","00-21-70-81-2C-96","Media Disconnected"
"Local Area Connection 2","Bluetooth Personal Area Network","00-21-86-A6-6E-27","Media Disconnected"

I suspect that I will have to use shellexecute. Any advice welcome
Avatar of Geert G
Geert G
Flag of Belgium image

what about using the > file
and then opening the file using a stringlist.loadfromfile

i suspect indeed you will need to use ShellExecute
Avatar of lloydie-t
lloydie-t

ASKER

I don't seem to be able to execute 'getmac /v /fo csv | findstr Local > macaddr.dat' in tpc. Also I have just found out the shellexecute will run asyncronously from the app so it may be that the outputed file will not be available to read.
i'm not that good at command line parsing myself yet,
i'm still in the process of learning it all
i use  this reference
http://technet.microsoft.com/nl-be/library/bb491071(en-us).aspx
ASKER CERTIFIED SOLUTION
Avatar of lloydie-t
lloydie-t

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial