1.

Solve : I think i made an error in the code but cant see where plz help?

Answer»

K so well yea if you look at the code you will know what it is but i tried to modify it so that you can make a choose profiles but the profiles doesnt CREATE please help

Code:

Code: [Select]:menu
cls
@echo off
title IP Changer
echo --------------------------------------------------------------------------------
echo IP Changer by Inforcer25
echo --------------------------------------------------------------------------------
echo.
echo.
echo.
echo.
echo.
echo Select a Option
echo ================
echo.
echo [1] Set Static IP [4] Make Profile
echo [2] Set DHCP [5] DELETE Profile
echo [3] Use Profile
echo.
set /p op=Enter Option:
if %op%==1 goto set_static_ip
if %op%==2 goto set_dhcp
if %op%==3 goto use_profile
if %op%==4 goto make_profile
if %op%==5 goto del_profile
goto error



:set_static_ip
cls
@echo off
echo "Please enter Static IP Address Information"
echo "Static IP Address:"
set /p IP_Addr=

echo "Default Gateway:"
set /p D_Gate=

echo "Subnet Mask:"
set /p Sub_Mask=

echo "Setting Static IP Information"
netsh interface ip set address "LAN" static %IP_Addr% %Sub_Mask% %D_Gate% 1
netsh int ip show config
pause
goto menu



:set_dhcp
cls
@ECHO OFF
ECHO Resetting IP Address and Subnet Mask For DHCP
netsh int ip set address name = "LAN" source = dhcp

ipconfig /renew

ECHO Here are the new settings for %computername%:
netsh int ip show config

pause
goto menu


:use_profile
@echo off
cd C:\IP_Changer\Profiles
cls
echo.
echo.
echo.
echo.
echo Please enter the profile name.
echo.
set /p profile=Profile name:
call %profile%.bat
goto no_profile

:no_profile
cls
echo.
echo.
echo.
echo ERROR!
echo That Profile does not exist!
echo.
echo.
ECHO Press any key to go back
pause<null
goto use_profile



:make_profile
if not exist "C:\IP_Changer" mkdir C:\IP_Changer\Profiles
cls
@echo off
echo.
echo.
echo.
echo.
echo.
set /p %make_prof%=Enter Profile name:
if exist "C:\IP_Changer\Profiles\%make_prof%.bat" goto exist
if not exist "C:\IP_Changer\Profiles\%make_prof%.bat" goto make_profile_make
:exist
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo A Profile with this name already exists
echo.
echo Press any key to continue
pause<null
:make_profile_make
cls
@echo off
echo.
echo.
echo.
echo --------------------------------------------------------------------------------
echo Setting up Profile
echo --------------------------------------------------------------------------------
echo.
echo.
echo.
echo.
echo.
echo Select a Option
echo ================
echo.
echo [1] Set Static IP
echo [2] Set DHCP
echo.
set /p op=Enter Option:
if %op%==1 goto static_batch
if %op%==2 goto dhcp_batch
goto error
:static_batch
cls
set /p %make_prof_make1%=Re-Enter Profile name:
if not exist "C:\IP_Changer\Profiles\%make_prof_make1%.bat" mkdir C:\IP_Changer\Profiles\%make_prof_make1%.bat
@echo off
echo "Please enter Static IP Address Information"
echo "Static IP Address:"
set /p IP_Addr=Static IP:

echo "Default Gateway:"
set /p D_Gate=Default Gateway:

echo "Subnet Mask:"
set /p Sub_Mask=Subnet Mask:

echo "Setting Static IP Information"
netsh interface ip set address "LAN" static %IP_Addr% %Sub_Mask% %D_Gate% 1 >C:\IP_Changer\Profiles\%make_prof_make1%.bat
netsh int ip show config
pause
goto finish_setup
:dhcp_batch
@ECHO OFF
ECHO Resetting IP Address and Subnet Mask For DHCP
netsh int ip set address name = "LAN" source = dhcp >C:\IP_Changer\Profiles\%make_prof_make1%.bat

ipconfig /renew

ECHO Here are the new settings for %computername%:
netsh int ip show config

pause
goto finish_setup



:finish_setup
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Profile setup finish! Press enter to go to menu.
pause>nul
goto menu



:exit
@echo off
cls
echo.
echo.
echo.
echo --------------------------------------------------------------------------------
echo Thank you for using IP_Changer
echo --------------------------------------------------------------------------------
ping localhost -n 5 >nul
exit

:error
cls
echo.
echo.
echo.
echo --------------------------------------------------------------------------------
echo Error! Wrong Command
echo --------------------------------------------------------------------------------
ping localhost -n 5 >nul
goto menu

:del_profile
@echo off
echo.
echo.
echo.
echo.
echo.
echo Enter Profile name you WISH to delete!
echo.
set /p %del_prof%=Enter Profile name:
if not exist "C:\IP_Changer\Profiles\%del_prof%.bat" goto error_prof
if exist "C:\IP_Changer\Profiles\%del_prof%.bat" goto del_finish


:error_prof
cls
@echo off
echo.
echo.
echo.
echo.
echo.
echo Error! That profile does not exist!
ping localhost -n 5 >nul
goto del_profile


:del_finish
cls
@echo off
echo.
echo.
echo.
echo.
echo.
echo The profile has been delete!
ping localhost -n 5 >nul
goto menuThat's really not the way to go about asking for help with code - "My code doesn't WORK" is the same as saying "my computer is broken" - We need more information, what errors are you getting? Where about in the code is the error? What have you tried to fix it? People are generally happy to advise on general errors but much more reluctant to just fix a piece of code they are given for the person asking.Until your have get it right remove:
@echo off
You will be able to trace the progress and see the error.



Discussion

No Comment Found