|
|
设置IP是个比较费劲的事,那么有没有比较简单的方法一键设置呢?
; W, [6 v! l( z4 G- b6 @' |, }( u8 v3 b+ R! G
将以下文件复制到新建的文本文档的,然后另存为IP.bat文件,双击运行,根据情况选择。IP地址可以改成适合自己设置的。- @echo off2 }, @; L- M2 Z+ F5 y
- title 自动设置ip
! `. E5 q; W5 \2 Z- {7 H - echo
, A! k8 q# j+ L - :start F/ v3 S8 M; J0 u
- cls E2 j3 ]/ c+ ^8 [0 r3 o
- ECHO ================================
& h+ s( r( F: T! s# r: \* \ - ECHO 请选择要换的ip 6 k, S u# U$ A- l
- ECHO ————————————————
/ Q- o1 C1 Z2 s, \6 ^( w - echo 无线网络连接---自动获取IP地址…………1 3 }5 _! @2 @2 q2 @; k6 X, r
- echo. 1 Y4 M3 F. B) j3 E2 c: ^) |
- echo 无线网络连接---办公室IP配置……………2 3 Q5 l4 x |4 H& _3 U( B9 {) ~) U
- echo. 1 q; ~9 a) l1 s
- echo 本地连接---自动获取IP地址………………3 . Y* [: t: R, J4 S
- echo.
! f9 o0 G* Z I$ |; l - echo 本地连接---办公室IP配置…………………4 q! z; U _7 y* A9 S3 @4 X
- echo.+ ^5 ^' B& N5 e5 Z. v* p+ T6 S
- echo 退出…………………………………………5
. ^$ r5 d$ f5 W& S) {+ `# f/ l - echo.6 m5 d3 A/ x7 a. F# H4 S- l
- # v8 [) A9 ?- t7 f
- @set /p UserSelection=选择(1,2,3,4,5)
2 C! Y% g1 W( J; d& m. X$ v - $ A* d2 l8 W* q! w' s
- if %UserSelection% LEQ 5 if %UserSelection% GEQ 1 goto selection # K2 n9 D0 b- U X3 N. G
- goto start 2 F8 |. S% I& `" [
! T: V# I3 H+ D. s# h- :selection
& [2 R; I2 B+ o& z - @if "%UserSelection%"=="1" goto 1
+ E+ I5 D; I* E `! e6 f - @if "%UserSelection%"=="2" goto 2
9 i7 s) |5 ]# e: U3 |, F0 d - @if "%UserSelection%"=="3" goto 3
5 b& _. O! h: u7 _ _; U - @if "%UserSelection%"=="4" goto 4
% E, W8 x2 B8 {5 I+ @ - @if "%UserSelection%"=="5" goto 5& F" d9 v$ w/ [$ Y! Q7 l6 ]
7 L# ~9 x- J p: W! a- :1
) R# i: C& v2 P- i# ? - echo 无线网络连接---自动获取IP地址---请稍候...( O7 C" m3 d, r! \: h
- netsh interface ip set address name="无线网络连接" source=dhcp
+ t* Z: b, I6 F - netsh interface ip set dns name="无线网络连接" source=dhcp! A7 d, X5 B6 a2 g& g9 D
- exit
4 e0 a& b& z' n! t, l - 9 V! [- I% U p: P$ h, G4 S
- :2* R- c. L- @/ ^7 G N* A4 x) Z
- echo 无线网络连接---办公室IP配置---请稍候...
7 ^0 c& B& F, w1 i7 h4 U e - set ipaddress=192.168.0.1004 E( c" X" X2 f* U% n0 n1 a
- set subnetmask=255.255.255.0
4 {. g j% @2 D - set defaultGateway=192.168.0.1
8 m/ u* u1 R: f2 S ^* k - set dns=202.96.98.364 q& ^3 g$ @6 i/ a" ]* y
- netsh set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask% gateway=%defaultGateway% gwmetric=0# E. H% _4 w* U# L9 b! W
- rem netsh interface ip set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask%+ c5 ]0 ?5 Q7 E: R
- rem netsh interface ip set address name="无线网络连接" gateway=%defaultGateway% gwmetric=0
" N$ T/ e, A: q - netsh interface ip set dns name="无线网络连接" source=static addr=%dns% register=primary
3 C1 J0 h, |! e# s* u - rem netsh interface ip set dns name="无线网络连接" source=static addr=%dns%2 l) o( A/ C, V* L& L) G
- exit
( m1 K g, L0 B1 b
+ r# V+ v/ z2 N. E2 X1 @( ?# {- :3
8 q! U& S1 @6 T - echo 本地连接---自动获取IP地址---请稍候...: V y3 J, z( T* e
- netsh interface ip set address name="本地连接" source=dhcp
2 E$ z( M0 m7 h$ ?0 e. c% Z; P - netsh interface ip set dns name="本地连接" source=dhcp, G4 Z# w+ T3 S# F' ^ ?# |. ~
- exit2 ?0 t A `5 i' |2 h) |
! n1 ]& P3 ]8 Z% p- :4+ p* s" F% M4 {( c+ d$ Q4 m3 v
- echo 本地连接---办公室IP配置---请稍候...4 k+ I' k) E2 k- G) e: v
- set ipaddress=192.168.1.68
% S2 n# {5 u3 ?( F - set subnetmask=255.255.255.0$ D+ f- M; R) N1 w# H4 ^4 E) \1 c
- set defaultGateway=192.168.1.1
9 x: H6 ?# Y. }3 M4 C8 [ - set dns=202.102.128.68
, W' E& a( m. t0 B( t# I6 S, |( Z+ l - netsh interface ip set address name="本地连接" source=static addr=%ipaddress% mask=%subnetmask%
* r5 n, [3 {" D& v& N - netsh interface ip set address name="本地连接" gateway=%defaultGateway% gwmetric=0 f Y( |0 c n9 J. d8 H) \' `
- netsh interface ip set dns name="本地连接" source=static addr=%dns% register=primary( l& I3 t0 ]8 C) X/ k
- netsh interface ip set dns name="本地连接" source=static addr=%dns%
2 j; e% q7 c" H- L - exit
/ z* l4 z, U' c0 l. L3 T8 S8 D - 2 j8 v. C4 j# g* D: m7 N
- :5
* X7 W8 O1 I( ^4 h: D - echo 5
3 [% r2 h l: Q& e1 s6 {
复制代码 |
-
-
IP.bat
2.22 KB, 阅读权限: 1, 下载次数: 0
|