|
|
设置IP是个比较费劲的事,那么有没有比较简单的方法一键设置呢?2 u9 J# h( d9 I Z
2 c- B" T2 n2 B( a4 c. P8 l
将以下文件复制到新建的文本文档的,然后另存为IP.bat文件,双击运行,根据情况选择。IP地址可以改成适合自己设置的。- @echo off! |: H* W% O% j" ~
- title 自动设置ip+ X6 _) Y2 c) j" q0 T$ K3 {
- echo# O5 i2 ^4 @: v& j9 @
- :start
- d: u" Q* T1 P! R& i0 A - cls
/ v) X$ T% d1 Y; j# `. n3 @ - ECHO ================================
4 A5 X) b% K! A! X - ECHO 请选择要换的ip
0 v( u* l* i- R: `' ~. o7 N( x5 E - ECHO ————————————————
0 s1 p0 ^! j! X0 T - echo 无线网络连接---自动获取IP地址…………1
R; E( I+ @ b/ Q - echo.
& d1 G2 ]) J4 r# y, K7 p+ X) E# a - echo 无线网络连接---办公室IP配置……………2
) j* ~, z0 K; Q) e1 ^! c1 n - echo. . F( p4 V$ h0 P% Y" U
- echo 本地连接---自动获取IP地址………………3
C [. i, o7 L- E2 T, c5 j - echo. 5 Y9 J% Y5 v, N* H. k( Q2 r
- echo 本地连接---办公室IP配置…………………4% G# H! {/ A6 D" E
- echo.
- u4 G2 S* t3 Q7 V - echo 退出…………………………………………5
) e# q* R, R' v; P+ Z - echo.4 P' Q2 v( z0 ~6 \
3 F8 A& e: ~$ {1 }" r* B- @set /p UserSelection=选择(1,2,3,4,5)
: G, z$ L$ g2 J' n6 x1 f: H
6 v6 @5 h k& o5 x, `+ K) q- if %UserSelection% LEQ 5 if %UserSelection% GEQ 1 goto selection + y' b; y) U0 R! E3 G# x7 C
- goto start 3 U/ _9 z- z" H6 V+ b) m/ R3 ]$ s
- ' F6 p! l. Y7 @
- :selection ; D6 R7 t t2 `. u/ V0 D
- @if "%UserSelection%"=="1" goto 1
. P+ ^/ D4 P" o6 {: n - @if "%UserSelection%"=="2" goto 2$ O/ x! ~! y, E; C" i7 Y* g3 s5 u
- @if "%UserSelection%"=="3" goto 3 8 Q- o, I9 N6 M, U* m( A$ s% ~$ {
- @if "%UserSelection%"=="4" goto 4
) a' @) m2 s; R - @if "%UserSelection%"=="5" goto 5/ @! Y* T3 [4 \; l
- $ `. o" E P6 l* Y
- :1! F8 {( t8 y: A7 h* k: w# P
- echo 无线网络连接---自动获取IP地址---请稍候...9 K; I. P, J. d. Z! l# k
- netsh interface ip set address name="无线网络连接" source=dhcp& L% T4 ~' k5 Q* v6 ]
- netsh interface ip set dns name="无线网络连接" source=dhcp1 o/ c& F9 [9 {, R7 A1 W' {
- exit/ H9 r8 h8 Z/ k
6 c" w6 `1 u |' j5 h. f- :26 q$ F" F0 Z* r& G) L
- echo 无线网络连接---办公室IP配置---请稍候...
" m. A1 h8 H( A7 G: X - set ipaddress=192.168.0.100
0 w1 g) W* b/ C; U4 Y+ Q1 y: D - set subnetmask=255.255.255.0* W/ T! O; g1 F
- set defaultGateway=192.168.0.16 R+ t+ I; F- L$ q; g" t
- set dns=202.96.98.36+ Y. m' A$ q& t5 t' Z* B
- netsh set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask% gateway=%defaultGateway% gwmetric=0$ j1 u% n$ V' ?) I8 G
- rem netsh interface ip set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask%
4 K$ ?* o8 a+ o; M - rem netsh interface ip set address name="无线网络连接" gateway=%defaultGateway% gwmetric=0
3 a$ Q0 }. a- U9 t2 g - netsh interface ip set dns name="无线网络连接" source=static addr=%dns% register=primary" @8 v: t( D3 d* S
- rem netsh interface ip set dns name="无线网络连接" source=static addr=%dns%
5 d; U0 `$ W- }6 T/ W c: C" v - exit
0 A5 l6 {+ `7 r" L4 ] - ' T: Y4 I8 n5 T; r9 l* y8 E& N
- :3% c+ M) Q2 y7 v
- echo 本地连接---自动获取IP地址---请稍候...
/ c' x6 u% e( }; _- } - netsh interface ip set address name="本地连接" source=dhcp
3 s# Y* g6 G/ x- W3 ` - netsh interface ip set dns name="本地连接" source=dhcp8 t4 h# ~7 K8 o' k+ P# ?
- exit
8 b0 A4 X$ G" o5 K4 G
6 k& o; S. x0 V1 ?0 d8 E3 ~) ]- :49 k- ^( h' t& p/ D2 t! o
- echo 本地连接---办公室IP配置---请稍候...& @* ^9 D9 g3 U
- set ipaddress=192.168.1.68
1 ~2 }+ C: @0 u8 E$ A, f# D# s - set subnetmask=255.255.255.0
1 Z. z: H; H7 a - set defaultGateway=192.168.1.1& y0 Y1 |3 B9 V c6 S+ c
- set dns=202.102.128.68
4 K6 L* X, i* ~2 x6 e+ K2 W# ^ - netsh interface ip set address name="本地连接" source=static addr=%ipaddress% mask=%subnetmask%
7 {% i! T) c5 a - netsh interface ip set address name="本地连接" gateway=%defaultGateway% gwmetric=04 E: g4 ]6 f: l1 ~
- netsh interface ip set dns name="本地连接" source=static addr=%dns% register=primary
4 K3 n/ y. h2 |7 d - netsh interface ip set dns name="本地连接" source=static addr=%dns%
2 G$ Z6 \! N9 ~+ {9 E- Y" t8 K6 @' I - exit
7 E/ l- m3 v) q8 u5 ?9 j7 U - - y+ z! B# x# N: B% l9 ]
- :5
# w* I) S( K0 W2 d - echo 51 g- Z, E$ u$ h' s0 z: Z3 @$ P
复制代码 |
-
-
IP.bat
2.22 KB, 阅读权限: 1, 下载次数: 0
|