I'm currently busy with writing a batch file, code below, check the brackets:
@echo off
cls
:start
echo On which network card do you want to perform the configuration?
NetSh Interface IPv4 Show Interfaces
(already opened the available network cards. Some are connected, some are not. So the code that should come here has to detect the idx, and check if the state of the network cards is connected. After that it should show all the connected and available network cards that are eligible to perform the configuration on, and when that is done, the user should be able to choose on which connected and available network cards he wants to perform this configuration. I was thinking about doing it with an array, but I don't know how to do this to be honest.)
echo.
echo.
echo ======================
echo DHCP oor static?
echo press 1 for DHCP, 2 to configure automatically.
echo ======================
echo.
echo.
set /p choice=Choose option 1 or 2:
if '%choice%'=='1' goto :dhcp
if '%choice%'=='2' goto :static
)
IF "%choice%" == ""
:dhcp
echo Batch file will close itself, since u chose for automatic settings.
goto end
:static
echo Chosen for static settings. Enter the ip adress.
set /p varip=
echo Enter the subnetmask.
set /p varsm=
echo Enter the gateway.
set /p vargw=
echo Enter DNS.
set vardns1=
(code for printing the IP, subnet, gateway and DNS to the selected network card. I'm also looking for the code to perform this action. That is all, thanks in advance. Keep in mind that the information that the user has entered above should be printed to the selected network card.)
goto end
already opened the available network cards. Some are connected, some are not. So the code that should come here has to detect the idx, and check if the state of the network cards is connected. After that it should show all the connected and available network cards that are eligible to perform the configuration on, and when that is done, the user should be able to choose on which connected and available network cards he wants to perform this configuration. I was thinking about doing it with an array, but I don't know how to do this to be honest. (see brackets)
code for printing the IP, subnet, gateway and DNS to the selected network card. I'm also looking for the code to perform this action. That is all, thanks in advance. Keep in mind that the information that the user has entered above should be printed to the selected network card. (see brackets)