1. 程式人生 > >網路IP地址/MAC地址/網路代理一鍵設定指令碼(自動配置)

網路IP地址/MAC地址/網路代理一鍵設定指令碼(自動配置)

網路IP地址/MAC地址/網路代理一鍵設定指令碼... 一直在使用,卻不敢獨享,分享之...

@echo off
rem # ----------------------------------
rem # 介面 IP 配置        
rem # ---------------------------------- 
echo ##########################################################
echo ##########################################################
echo ###                                                    ###
echo ### IP Fast Confion (C) CopyRight do2jiang.CSU. 2008.9 ###
echo ###                                                    ###
echo ##########################################################
echo ##########################################################

echo 選擇"A"鍵,進行:自動獲取IP地址及DNS配置
echo 選擇"H"鍵,進行:浙江 Home 網路配置,號段:***.***.***.***
echo 選擇"R"鍵,進行:RaiWay Lab網路配置,號段:192.168.118.157
echo 選擇"M"鍵,進行:Min221 Lab網路配置,號段:192.168.10.61
echo 選擇"N"鍵,進行:NetWork518網路配置,號段:218.196.73.52
echo 選擇"L"鍵,進行:L Showing 5-115網路配置,號段:218.196.68.78
echo 選擇"D"鍵,進行:Dormitory 網路配置,號段:218.196.91.155-》IE代理
echo 選擇"T"鍵,進行:Tao 哥MAC 網路配置,號段:218.196.91.42 -》IE直連
echo 選擇"G"鍵,進行:小  高MAC 網路配置,號段:218.196.91.186-》IE直連
echo 選擇"W"鍵,進行:Work Place網路配置,號段:***.***.**.***
echo 選擇"Q"鍵,退出程式

echo 請選擇"D"或"H"或"R"或"M"或"D"或"W"或"G"或者"T"或者"N"或者"L"進行網路配置,回車確定:
set /p ch=
if %ch%==""  echo "You input null"&goto:EOF
set case=a,A,h,H,r,R,m,M,d,D,t,T,g,G,n,N,l,L,Q,q /w>nul
echo %case%|findstr "/<%ch%/>">nul&if errorlevel 1  goto:err
goto %ch%
goto err

::DHCP "dhcp自動獲取IP地址"
:A
:a
echo "configure MAC,please wait 10 second ..."
::SKY的MAC
reg delete HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /f
reg add HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /d 001d72289d62
@devcon disable *DEV_1693*
@devcon enable  *DEV_1693*
reg add "HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings" /v  ProxyEnable /t reg_dword /d 000000000 /f

echo "configure ip address gateway,please wait 30 second ..."
@netsh int ip set address "本地連線"  dhcp >nul
@netsh int ip set dns  "本地連線"  dhcp   >nul
echo ip configure is done
goto : EOF

::home
:H
:h
::"Config IP of Home"
echo "configure MAC,please wait 10 second ..."
::SKY的MAC
reg delete HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /f
reg add HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /d 001d72289d62
@devcon disable *DEV_1693*
@devcon enable  *DEV_1693*
reg add "HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings" /v  ProxyEnable /t reg_dword /d 000000000 /f

echo "configure ip address gateway,please wait 30 second ..."
@netsh int ip set address "本地連線" static 10.51.139.18 255.0.0.0 10.51.139.1 1 >nul
@netsh int ip set dns  "本地連線" static 10.51.139.1 PRIMARY >nul
echo ip configure is done
goto : EOF

::鐵道513實驗室
:R
:r
::"Config IP of RailWay.Lab"
echo "configure MAC,please wait 10 second ..."
::SKY的MAC
reg delete HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /f
reg add HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /d 001d72289d62
@devcon disable *DEV_1693*
@devcon enable  *DEV_1693*

echo "configure ip address gateway,please wait 30 second ..."
@netsh interface ip set address name="本地連線" source=static addr=192.168.118.157 mask=255.255.255.0
@netsh interface ip set address name="本地連線" gateway=192.168.118.3 gwmetric=0
@netsh interface ip set dns name="本地連線" source=static addr=202.197.64.6 register=PRIMARY
@netsh interface ip add dns name="本地連線" addr=202.103.96.112 index=2
@netsh interface ip set wins name="本地連線" source=static addr=none
reg add "HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings" /v  ProxyEnable /t reg_dword /d 000000000 /f
::靜態對映
@echo on
arp -s 192.168.118.3 00-13-46-69-ee-72
@echo off
ipconfig
echo ip configure is done
goto : EOF

::民主樓221實驗室
:M
:m
::"Config IP of Min221.Lab"
echo "configure MAC,please wait 10 second ..."
::SKY的MAC
reg delete HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /f
reg add HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /d 001d72289d62
@devcon disable *DEV_1693*
@devcon enable  *DEV_1693*
reg add "HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings" /v  ProxyEnable /t reg_dword /d 000000000 /f

echo "configure ip address gateway,please wait 30 second ..."
@netsh interface ip set address name="本地連線" source=static addr=192.168.10.61 mask=255.255.255.0
@netsh interface ip set address name="本地連線" gateway=192.168.10.1 gwmetric=0
@netsh interface ip set dns name="本地連線" source=static addr=202.197.64.6 register=PRIMARY
@netsh interface ip add dns name="本地連線" addr=202.103.96.112 index=2
@netsh interface ip set wins name="本地連線" source=static addr=none
::靜態對映
::arp -s 192.168.118.3 00-e0-4c-b3-28-90
ipconfig
echo ip configure is done
goto : EOF

::本部十舍518寢室--NetWork518
:N
:n
echo "configure MAC,please wait 10 second ..."
::SKY的MAC
@reg delete HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /f
@reg add HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /d 001d72289d62
@devcon disable *DEV_1693*
@devcon enable  *DEV_1693*

::"Config IP for NetWork 518"
echo "configure ip address gateway,please wait 30 second ..."
@netsh interface ip set address name="本地連線" source=static addr=218.196.73.52 mask=255.255.255.0
@netsh interface ip set address name="本地連線" gateway=218.196.73.254 gwmetric=0
@netsh interface ip set dns name="本地連線" source=static addr=202.197.64.6 register=PRIMARY
@netsh interface ip add dns name="本地連線" addr=202.103.96.68 index=2
@netsh interface ip set wins name="本地連線" source=static addr=none
echo ip configure is done
 
echo “使用者名稱:a0105183s”
echo ”密碼:XXX


goto : EOF



::115
:L
:l
echo "configure MAC,please wait 10 second ..."
::SKY的MAC
@reg delete HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /f
@reg add HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /d 0019660e0782
@devcon disable *DEV_1693*
@devcon enable  *DEV_1693*

::"Config IP for NetWork 518"
echo "configure ip address gateway,please wait 30 second ..."
@netsh interface ip set address name="本地連線" source=static addr=218.196.68.78 mask=255.255.255.0
@netsh interface ip set address name="本地連線" gateway=218.196.68.254 gwmetric=0
@netsh interface ip set dns name="本地連線" source=static addr=202.197.64.6 register=PRIMARY
@netsh interface ip add dns name="本地連線" addr=202.103.96.68 index=2
@netsh interface ip set wins name="本地連線" source=static addr=none
echo ip configure is done
 
echo "使用者名稱:a0051153s"
echo "密  碼:XXX
"
goto : EOF


::本部十舍518寢室--代理
:D
:d
::"Config IP of Dormitory "
echo "configure MAC,please wait 10 second ..."
::SKY的MAC
reg delete HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /f
reg add HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /d 001d72289d62
@devcon disable *DEV_1693*
@devcon enable  *DEV_1693*

echo "configure ip address gateway,please wait 30 second ..."
@netsh interface ip set address name="本地連線" source=static addr=218.196.91.157 mask=255.255.255.0
::刪除閘道器
@netsh interface ip delete address "本地連線" gateway=all
::設定區域網代理
set ProxyServerValue=ftp=218.196.91.42:808;http=218.196.91.42:808;https=218.196.91.42:808;socks=218.196.91.42:1080
reg add "HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings" /v  ProxyServer /t reg_sz /d %ProxyServerValue% /f
reg add "HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings" /v  ProxyEnable /t reg_dword /d 000000001 /f

echo ip configure is done
goto : EOF

::本部十舍518寢室--代理(突破代理禁用)
:C
:c
::"Config IP of Dormitory "
echo "configure MAC,please wait 10 second ..."
::Tao哥的MAC
reg delete HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /f
reg add HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /d 00508d6a023e
@devcon disable *DEV_1693*
@devcon enable  *DEV_1693*

echo "configure ip address gateway,please wait 30 second ..."
@netsh interface ip set address name="本地連線" source=static addr=218.196.91.157 mask=255.255.255.0
::刪除閘道器
@netsh interface ip delete address "本地連線" gateway=all
::設定區域網代理
set ProxyServerValue=ftp=218.196.91.42:808;http=218.196.91.42:808;https=218.196.91.42:808;socks=218.196.91.42:1080
reg add "HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings" /v  ProxyServer /t reg_sz /d %ProxyServerValue% /f
reg add "HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings" /v  ProxyEnable /t reg_dword /d 000000001 /f

echo ip configure is done
goto : EOF

::本部十舍518寢室--Tao哥MAC直連
:T
:t
::"Config MAC of Tao哥"
echo "configure ip address gateway,please wait 30 second ..."
@netsh interface ip set address name="本地連線" source=static addr=218.196.91.42 mask=255.255.255.0
@netsh interface ip set address name="本地連線" gateway=218.196.91.254 gwmetric=0
@netsh interface ip set dns name="本地連線" source=static addr=202.197.64.6 register=PRIMARY
@netsh interface ip add dns name="本地連線" addr=202.103.96.68 index=2
@netsh interface ip set wins name="本地連線" source=static addr=none
reg add "HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings" /v  ProxyEnable /t reg_dword /d 000000000 /f
::濤哥的MAC
reg delete HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /f
reg add HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /d 00508d6a023e
devcon disable *DEV_1693*
devcon enable  *DEV_1693*
echo MAC configure is done
echo "使用者名稱:a0105182s"
echo "密  碼:XXXX
"
goto : EOF

::本部十舍518寢室--小高MAC直連
:G
:g
::"Config MAC of Tao哥"
echo "configure ip address gateway,please wait 30 second ..."
@netsh interface ip set address name="本地連線" source=static addr=218.196.91.186 mask=255.255.255.0
@netsh interface ip set address name="本地連線" gateway=218.196.91.254 gwmetric=0
@netsh interface ip set dns name="本地連線" source=static addr=202.197.64.6 register=PRIMARY
@netsh interface ip add dns name="本地連線" addr=202.103.96.68 index=2
@netsh interface ip set wins name="本地連線" source=static addr=none
reg add "HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings" /v  ProxyEnable /t reg_dword /d 000000000 /f
::小高的MAC
reg delete HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /f
reg add HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /d 001617169e73
devcon disable *DEV_1693*
devcon enable  *DEV_1693*

echo MAC configure is done
echo "使用者名稱:a0105181s"
echo "密  碼:xxxx "
goto : EOF

::工作單位
:W
:w
::"Config IP of work intranet"
echo "configure MAC,please wait 10 second ..."
::SKY的MAC
reg delete HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /f
reg add HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Class/{4D36E972-E325-11CE-BFC1-08002bE10318}/0014 /v NetworkAddress /d 001d72289d62
@devcon disable *DEV_1693*
@devcon enable  *DEV_1693*
reg add "HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Internet Settings" /v  ProxyEnable /t reg_dword /d 000000000 /f

echo "configure ip address gateway,please wait 30 second ..."
@netsh int ip set address "本地連線" static 192.168.1.118 255.255.255.0 192.168.1.1 1 >nul
@netsh int ip set dns  "本地連線"  static 192.168.1.1  PRIMARY >nul
echo ip configure is done
goto : EOF

::------------------------------------------ QUIT -------------------------------
:q
:Q
goto : EOF

::錯誤輸入
:err
::"error"
echo your input "%ch%" , no this argument!
game over!
goto : EOF