My BAT script
@ECHO off
:start
cls
ECHO.
ECHO Press : 1. Get IP from DHCP
ECHO 2. Change IP : 192.168.10.x / 32
ECHO 3. Show Ip config
ECHO X. Exit
set choice=
echo Choice :
set /p choice=
if not '%choice%'=='' set choice=%choice:~0,1%
:: Lay bat dau tu ky tu 0 cua chuoi~, do dai cua chuoi la 1.
:: choice=abcdef
::%choice:~3,2%=de
if '%choice%'=='1' goto function1
if '%choice%'=='2' goto function2
if '%choice%'=='3' goto function3
if '%choice%'=='x' goto end
ECHO "%choice%" is not valid please try again
ECHO.
goto start
:function1
echo.
Netsh interface ip set address name="lan" dhcp
goto end
:function2
set x=
echo.
echo IP : 192.168.10.X
echo X =
Set /p x=
Netsh interface ip set address name="lan" static 192.168.10.%x% 255.255.255.0
goto end
:function3
ipconfig | find /I "lan"
pause
goto start
::Local Area Connection
:end
Script work fine, but i want it all automatic. I don't need to input anything
. To make the script automatically, i think the first thing i need to know
DHCP status of the interface. and then if DHCP is yes ----> run :function2, else run function1. I don't know how to get the DHCP status of an interface,
how if machine have 1 interface and more than 2 interface?