| View previous topic :: View next topic |
| Author |
Message |
Tom Guest
|
Posted: Mon Nov 30, 2009 9:56 pm Post subject: MAC Address |
|
|
Hi
I've searched the forum and found a few ways to find the MAC Address of a LAN card, but they all involve ipconfig /all > file.txt then searching the file.
Is it possible to do this, but send the results to a array(variable) and then filter/search that ?? so no file is written and the work is done in memory ?
Thanks in advance. |
|
| Back to top |
|
 |
txquestor
Joined: 22 Aug 2009 Posts: 294
|
|
| Back to top |
|
 |
TLM
Joined: 21 Aug 2006 Posts: 2926 Location: The Shell
|
Posted: Tue Dec 01, 2009 4:33 am Post subject: |
|
|
Another method.
Still writes a file but deletes it so fast you'd never know it was ever written.
| Code: | RunWait, %comspec% /c ""ipconfig" "/all" >"%A_Desktop%\macInfo.txt"",,Hide
FileRead, fileInfo, % A_Desktop "\macInfo.txt"
Loop, Parse,fileInfo, `n, `r
{
if A_LoopField contains Physical Address
{
StringTrimLeft, macAdd, A_LoopField, 44
FileDelete, % A_Desktop "\macInfo.txt"
Break
}
}
Msgbox, % "MAC ADDRESS: " macAdd |
hth _________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞ |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 3113 Location: MN, USA
|
|
| Back to top |
|
 |
Tom Guest
|
Posted: Tue Dec 01, 2009 8:42 pm Post subject: |
|
|
Thanks for the replies.
got this working using TLM's example, would prefer for this to be done in memory, I don't understand how to do it !
If anyone can help I would appreciate it.
Thank you. |
|
| Back to top |
|
 |
TLM
Joined: 21 Aug 2006 Posts: 2926 Location: The Shell
|
Posted: Wed Dec 02, 2009 1:03 am Post subject: |
|
|
Did you see the example jaco0646 linked to? It basically runs bat commands, stores and 'calls' the value to (now dont quote me) the environment variable %0
I'm still trying to figure out how to store the value to the current script instance.
Its not obvious but way easier than the functions method (plus no external lib needed ).
Will report back if I figure it out. _________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞ |
|
| Back to top |
|
 |
|