Hi Below is a Batch to Change your IP Address. Works good to change the IP
But i want it to Display Current IP Save that Data into IP_OLD Var and Chnage IP then Display OLD IP to NEW IP
So The Problem is the Follow: Quote:
IP Address. . . . . . . . . . . . : 7X.2XX.9X.2XX
IP Address. . . . . . . . . . . . : fe30::711:5bff:fe84:5960%4
IP Address. . . . . . . . . . . . : fe30::ffff:ffff:fffd%5
IP Address. . . . . . . . . . . . : 2102:44ed:23c9::47ed:63c9
IP Address. . . . . . . . . . . . : fe80::51fe:31.237.19.241%2
|
IT Display's Last Line "
fe80::51fe:31.237.19.241%2" I want it to Display only the Top Line the Real IP. Same is Happening with the MAC Address.
One other Question is there Better Way to Do Message Box Other then VBS Below is The Batch File Code to Change IP. ChangeIP.bat Quote:
:Change IP Batch File
:Written by NeroMorte
COLOR 0C
@ECHO off
:Below are the choices.
set PcK1=Yes
set PcK2=No
:Gobal Settings
SET TEMP1=TEMP_IP
SET TEMP2=TEMP_MAC
SET IP_OLD=''
:Choices
cls
ECHO.Change IP Batch File
ECHO.Batch File Coded by NeroMorte
ECHO.
ECHO.
ECHO.
ECHO.Please select Yes / No from the following:
ECHO.
ECHO. 1. %PcK1%
ECHO. 2. %PcK2%
ECHO.
set /p PcKs=Pick Number or Type Yes To Continue or No to Exit?
ECHO.
ECHO.
REM ##########################################################
REM NOT : perform the command if the condition is false.
REM == : perform the command if the two strings are equal.
REM /I : Do a case Insensitive string comparison.
REM EQU : equal
REM NEQ : not equal
REM LSS : less than <
REM LEQ : less than or equal <=
REM GTR : greater than >
REM GEQ : greater than or equal >=
REM ##########################################################
IF NOT '%PcKs%' EQU '' set TheChoice=%PcKs%
IF %PcKs% EQU Yes set TheChoice=%PcKs%
IF %PcKs% EQU No set TheChoice=%PcKs%
IF %PcKs% EQU 1 set TheChoice=%PcKs%
IF %PcKs% EQU 2 set TheChoice=%PcKs%
IF %TheChoice% EQU Yes GOTO One
IF %TheChoice% EQU No GOTO Two
IF %TheChoice% EQU 1 GOTO One
IF %TheChoice% EQU 2 GOTO Two
ECHO "%PcKs%" is not valid Entry please try again.
ECHO.
Pause
GOTO Choices
:One
ECHO YOU HAVE PICKED NUMBER ONE
ECHO.
@ECHO off
:: Get the current IP address
@IPCONFIG /ALL | FIND /I "IP Address" > %TEMP1%
@FOR /F "tokens=1-6 delims=,:. " %%i in (%TEMP1%) do (
@SET IP=%%k %%l %%m %%n
)
:: Get MAC Address
@IPCONFIG /ALL | FIND /I "Physical Address" > %TEMP2%
@FOR /F "tokens=1-6 delims=,:. " %%o in (%TEMP2%) do (
@SET MAC=%%q
)
@cls
GOTO ChangeIP
:END
:ChangeIP
ECHO.
ECHO. Username: %username%
ECHO. IP Address: %IP%
ECHO. MAC Address: %MAC%
ECHO. PC Name: %Computername%
ECHO. Time/Date Requested IP Change: %TIME%/%Date%
ECHO.
ECHO.
ECHO. ... Changing IP Please Wait ...
ECHO.
Set IP_OLD=%IP%
Pause
@ECHO off
ipconfig /flushdns
ipconfig /release
@cls
ECHO. ... Changing IP Please Wait ...
netsh interface ip set address "Local Area Connection 2" static 107.70.125.50 255.0.0.0 24.8.128.1 1
ipconfig /renew
@cls
ECHO. ... Changing IP Please Wait ...
netsh interface ip set address "Local Area Connection 2" dhcp
netsh interface ip set DNS "Local Area Connection 2" dhcp
netsh interface ip set WINS "Local Area Connection 2" dhcp
@cls
:: Get the current IP address
@IPCONFIG /ALL | FIND /I "IP Address" > %TEMP1%
@FOR /F "tokens=1-6 delims=,:. " %%i in (%TEMP1%) do (
@SET IP=%%k %%l %%m %%n
)
:: Get MAC Address
@IPCONFIG /ALL | FIND /I "Physical Address" > %TEMP2%
@FOR /F "tokens=1-6 delims=,:. " %%o in (%TEMP2%) do (
@SET MAC=%%q
)
ECHO. MsgBox "- New IP Address: %IP% -" + vbcr + "- OLD IP Address: %IP_OLD% -" ,64 + 4096,"%username%'s IP Changed Successful" > msgbox.vbs
Start msgbox.vbs
::goto ExitBatch
:END
:Error
ECHO Please Try again!
GOTO Choices
:END
:Two
ECHO YOU HAVE PICKED NUMBER TWO PRESS ANY KEY TO EXIT.
Pause
@cls
EXIT
:END
:Error
ECHO Please Try again!
GOTO Choices
:END
:ExitBatch
:: Clear the Temp file
@ECHO off
echo. > %TEMP1%
echo. > %TEMP2%
@cls
ECHO. ... Please Wait Clearing Temp Files ...
ECHO Y | DEL %TEMP1% /S /Q
ECHO Y | DEL %TEMP2% /S /Q
@cls
ECHO. ... Please Wait Clearing Temp Files ...
@Echo off
@Echo =-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=
@Echo =! !=
@Echo =! Exiting Thanks for Using NeroMorte IP Changer!! !=
@Echo =! !=
@Echo =! !=
@Echo =! !=
@echo =! IP-Changer Window will disappear in 10 seconds! !=
@Echo =-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=-_-=
@ping -n 10 127.0.0.1 > nul
::@pause
EXIT
:END
|