From: http://ywh5.bokee.com/viewdiary.13113717.html
Private string getphysicaladdress (){
String cmd = "cmd.exe/C ipconfig/all ";
String strrs = "";
String result = "";
Strrs = executesyscmd (CMD );
Result = parsecmd (strrs );
Return result;
}
Private string executesyscmd (string shellcommand ){
Try {
Start (shellcommand );
Stringbuffer sb = new stringbuffer ();
Datainputstream in = new datainputstream (P. getinputstream ());
Bufferedreader reader = new bufferedreader (New inputstreamreader (in ));
String line;
Do {
Line = reader. Readline ();
If (line = null ){
Break;
}
Else {
Sb. append (line );
}
}
While (true );
Reader. close ();
Return sb. toString ();
}
Catch (exception e ){
// Error
Return NULL;
}
}
Private string parsecmd (string s ){
String find = "physical address .........:";
Int findindex = S. indexof (FIND );
If (findindex =-1)
Return "not find ";
Else
Return s. substring (findIndex + find. length () + 1,
FindIndex + find. length () + 1 + _ physicalLength );
}
You can reference this article through this link: http://ywh5.bokee.com/tb. B? DiaryId = 13113717
I have posted this article !! Come back in the evening to verify the correctness !!!