


@echo off

:: BatchGotAdmin
:-------------------------------------

>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"


if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    set params = %*:"=""
    echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
    exit /B

:gotAdmin
    pushd "%CD%"
    CD /D "%~dp0"
:--------------------------------------


@echo off

:mainmenu 
title IP Setup
cls 


echo ********************* 
echo * Static IP *
echo ********************* 
echo * 1. Set 192.168.1.* Static * 
echo * 2. Set 10.1.1.* Static *
echo * 3. Set DHCP * 
echo * 4. Quit * 
echo ********************* 
choice /C:1234 >nul

if %errorlevel% equ 1 goto 192 
if %errorlevel% equ 2 goto 10 
if %errorlevel% equ 3 goto dhcp 
if %errorlevel% equ 4 goto quit

REM closes the program
:quit 
exit /b

REM sets static IP
:192

@echo off
netsh interface ip set address name="Ethernet" source=static ^ address=192.168.1.5 mask=255.255.255.0 gate=192.168.1.1

pause 
goto mainmenu 

:10

@echo off
netsh interface ip set address name="Ethernet" source=static ^ address=10.1.1.5 mask=255.255.255.0 gate=10.1.1.1

pause 
goto mainmenu 

REM sets DHCP
:dhcp

@echo off
netsh interface ip set address name="Ethernet" source=dhcp
netsh interface ip set dnsservers "Ethernet" source=dhcp
netsh interface ipv4 add dnsserver "Ethernet" source=dhcp

pause
goto mainmenu