|
|
设置IP是个比较费劲的事,那么有没有比较简单的方法一键设置呢?
; j6 w. L0 X- }# k( t
0 ?& G& J2 B5 W- n/ h5 e h将以下文件复制到新建的文本文档的,然后另存为IP.bat文件,双击运行,根据情况选择。IP地址可以改成适合自己设置的。- @echo off
4 B& C& J) l, x) H - title 自动设置ip% [ }2 k+ Q- L. O1 M
- echo
& P" ^' q$ d0 L4 ~# E - :start
) b& w. } Y6 ]$ h5 X - cls
3 L( V9 t1 A9 Y; W - ECHO ================================ / _5 z2 H3 _( M. S" R) b# D
- ECHO 请选择要换的ip
# J T: ^. }3 } - ECHO ———————————————— 6 i7 n7 c4 l2 x; G- p) k
- echo 无线网络连接---自动获取IP地址…………1
5 R! i% |. b; W6 l! g+ {4 y* ~ - echo. T" x3 G# p0 c7 m/ e
- echo 无线网络连接---办公室IP配置……………2
% e* A O6 x" J7 s% v: w& V - echo. 3 N9 N: j- O; F
- echo 本地连接---自动获取IP地址………………3 # U1 T- Z; K7 Y6 _
- echo. ) R' Y8 |, k2 ] g2 o- ~
- echo 本地连接---办公室IP配置…………………49 u2 ]$ T* r6 i
- echo.
$ w( P& O) s N - echo 退出…………………………………………5
% D) u& L: @- U0 O1 ]! j9 B0 R - echo.; K/ {7 u1 z4 r: V1 Y4 ^1 H3 V5 n$ X. B
- / h5 V- ~5 x+ i3 b% z5 f( b$ ] z
- @set /p UserSelection=选择(1,2,3,4,5)
7 ?. R+ m0 v$ B t9 ]4 l- D0 ^
" G3 ~. q8 ~/ p' q* Z- if %UserSelection% LEQ 5 if %UserSelection% GEQ 1 goto selection " L; a3 ~/ g6 d, i3 ]4 n" y" x
- goto start ) k8 b; C" N( C( W& B
- 7 ~; ~3 ^/ @) W7 E" i. @
- :selection ' w; C p- D" e$ C" L4 n
- @if "%UserSelection%"=="1" goto 1
& L$ l: @- Z* v" W% x - @if "%UserSelection%"=="2" goto 2
. {: ?" r! ^6 \9 U$ ?3 z. v - @if "%UserSelection%"=="3" goto 3
1 Q+ v2 F. k4 Q8 R) r3 z - @if "%UserSelection%"=="4" goto 4
, i( l N3 Q8 Z% l9 n# y1 N - @if "%UserSelection%"=="5" goto 5
G- I. t2 i$ t5 u H - * {" h0 i$ [0 F- k! Y- k
- :1
- X8 |7 e) n3 j, T! ?8 w: X" g - echo 无线网络连接---自动获取IP地址---请稍候...1 `! ?2 ~1 H. C7 O9 _- i: _' M- F7 n
- netsh interface ip set address name="无线网络连接" source=dhcp
9 Z+ ^2 m7 s# p - netsh interface ip set dns name="无线网络连接" source=dhcp" p; A; n! t! d; ~, I/ g0 I) K7 ?1 w
- exit8 |& E3 ?) X5 s# i+ S! X* \
- . U4 H3 g) O( k7 B6 E( H I
- :2% P* Q" S8 }% q2 x. V1 m9 t% }8 K
- echo 无线网络连接---办公室IP配置---请稍候...4 a# d" r+ B7 v6 m& `4 g2 s$ |3 f
- set ipaddress=192.168.0.100 Q |) }! v0 `- i9 E
- set subnetmask=255.255.255.0
2 j# Z3 X- b( x+ C; z - set defaultGateway=192.168.0.1
; ]' P" y; r. {8 L$ y - set dns=202.96.98.36
( Z$ d( V: q5 r$ y8 V0 o* c% X: W - netsh set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask% gateway=%defaultGateway% gwmetric=0
4 |5 D8 X' K' W% Y+ @& A. f4 n - rem netsh interface ip set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask%2 Y1 n1 ~ K6 E7 s+ \: z
- rem netsh interface ip set address name="无线网络连接" gateway=%defaultGateway% gwmetric=02 R, S2 X/ _! Q) T! l/ B0 o
- netsh interface ip set dns name="无线网络连接" source=static addr=%dns% register=primary
/ G3 v, i* K! D - rem netsh interface ip set dns name="无线网络连接" source=static addr=%dns%
, [) \# V* o" T# L: V+ Q* v+ Y( I) j - exit- g0 F6 V( E+ ~! c
- 4 z6 S' J$ y0 S' G" S
- :3; S9 \/ [( M9 O2 Z. e0 _6 Y" y; e7 F
- echo 本地连接---自动获取IP地址---请稍候...! \$ h8 J6 ~3 J/ u, M
- netsh interface ip set address name="本地连接" source=dhcp
) r( [7 d1 b ^1 J1 y - netsh interface ip set dns name="本地连接" source=dhcp# W9 ]2 T) P2 d! L2 p* J8 [
- exit! H# ]0 _/ @1 c# C2 x' w
- : ~/ H& e" R* L& F; y
- :4
) b9 D8 D- h* K" B4 B+ u( j - echo 本地连接---办公室IP配置---请稍候...
! w& k/ P, @! N0 ?4 z" v - set ipaddress=192.168.1.68: O* d* z, u. P9 w- ~6 l
- set subnetmask=255.255.255.08 M: P) T* |% j! t+ g' [
- set defaultGateway=192.168.1.1, \4 ^3 L* [3 X% Q
- set dns=202.102.128.68' j, d! \& t2 m. D; }
- netsh interface ip set address name="本地连接" source=static addr=%ipaddress% mask=%subnetmask%
9 g' c/ _: ~1 t; I9 z* _2 b% t - netsh interface ip set address name="本地连接" gateway=%defaultGateway% gwmetric=0
/ f, u& D& L0 e1 I* P' W9 ` - netsh interface ip set dns name="本地连接" source=static addr=%dns% register=primary3 K# y, e% l @6 z
- netsh interface ip set dns name="本地连接" source=static addr=%dns%) k$ Y0 {- S- Y; g& f1 l
- exit
k1 U& P$ c7 b1 ?* J5 H
1 |. r; w; i5 Y3 o- E- :54 }) @8 z# U( L9 s/ p- S
- echo 5
2 l0 \% J. B% G# n; t0 }& a' _
复制代码 |
-
-
IP.bat
2.22 KB, 阅读权限: 1, 下载次数: 0
|