How to get Local IP and MAC address
Page 1 of 1
How to get Local IP and MAC address
Hi
I want to share with you what i have tested on my PC with Windows 7 32 bits (French Machine) and of course i wonder if this same script will work or not on other machines (English, German and so on .....)
Here is the script :
Get_IP_MAC.bat
PHP Code:
Thank you
I want to share with you what i have tested on my PC with Windows 7 32 bits (French Machine) and of course i wonder if this same script will work or not on other machines (English, German and so on .....)
Here is the script :
Get_IP_MAC.bat
PHP Code:
- Code:
@echo off
Title Get IP and MAC Address
@for /f "delims=[] tokens=2" %%a in ('ping -4 -n 1 %ComputerName% ^| findstr [') do (
set "MY_IP=%%a"
)
@For /f %%a in ('getmac /NH /FO Table') do (
@For /f %%b in ('echo %%a') do (
If /I NOT "%%b"=="N/A" (
Set "MY_MAC=%%b"
)
)
)
echo Network IP : %MY_IP%
echo MAC Address : %MY_MAC%
pause>nul
Thank you
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|