mengubah ip address dengan script bat pada windows xp

Pernah terbayang dalam pikiran gw untuk bisa merubah ip address (static) dalam sekejap, baik itu pada adapter wireless maupun lan. Tentunya sebagian kita tahu bahwa merubah ip address di xp butuh beberapa proses mulai dari masuk Control Panel terus ke Internet Connenction dan bla..bla..bla..

Nah disini gw mau kasih tips gimana caranya merubah ip address static dengan cepat menggunakan script bat.
Langsung aja yah..
Pertama - tama buka notepad, kemudian ketikkan perintah berikut (asumsi kita akan merubah ip address pada adapter LAN) :
 
# ----------------------------------
# Interface IP Configuration        
# ----------------------------------
pushd interface ip

# Interface IP Configuration for "Local Area Connection"

set address name="Local Area Connection" source=static addr=192.168.1.10 mask=255.255.255.0
set address name="Local Area Connection" gateway=192.168.1.1 gwmetric=0
set dns name="Local Area Connection" source=static addr=202.130.0.155 register=PRIMARY

add dns name="Local Area Connection" addr=203.130.206.250 index=2
set wins name="Local Area Connection" source=static addr=none

# Interface IP Configuration for "Wireless Network Connection"


popd
# End of interface IP configuration


Simpan dengan nama speedy (misal.red), kemudian buat kembali file notepad yang sama tapi ubah sedikit pada bagian source=static addr=192.168.1.10 mask=255.255.255.0 diganti dengan dhcp. Simpan dengan nama dhcp. Setelah itu buka notepad dan ketikkan :

@echo off
title Mr. Hunt's IP Configuration Batch File - 2009
setlocal
set OK=N

:again
    set /p choice=Please enter 1[speedy], 2[dhcp] or end ??
    if /i [%choice%]==[END] endlocal&goto end
    if [%choice%]==[] goto again
    if [%choice%]==[1] goto 1
    if [%choice%]==[2] goto 2
    set /p xxx=wrong entry, press any key to exit. 
    endlocal
    goto end
:1
    echo NIC setting for speedy being configured.....
    @netsh exec speedy.txt
    set /p see=IP changed successfully to kantor Settings [9]see new setting [Enter]exit...
    if [%see%]==[9] goto show
    echo Ending IP Configuration
    goto end
:2
    echo NIC setting for dhcp being configured.....
    @netsh exec dhcp.txt
    set /p see=IP changed successfully to stikom Settings [9]see new setting [Enter]exit...
    if [%see%]==[9] goto show
    echo Ending IP Configuration
    goto end

:show
@netsh int ip show config

:end
@echo on
cls



Simpan dengan nama configip.bat kemudian simpan ketiga file tersebut pada satu folder, kemudian jika ingin merubah ip maka kita jalan kan saja file configip.bat, kemudian sesuaikan dengan opsi ip yang akan kita gunakan.
Good Luck

0 comments: