|
|
设置IP是个比较费劲的事,那么有没有比较简单的方法一键设置呢?
0 R1 {) Q; i( j8 Y! m+ a
3 D7 M: v, D7 z; ^将以下文件复制到新建的文本文档的,然后另存为IP.bat文件,双击运行,根据情况选择。IP地址可以改成适合自己设置的。- @echo off
7 F/ ]9 W6 k/ t; | - title 自动设置ip ?$ `7 t& A+ D. ]' M6 O0 ^
- echo
, z0 _ ^" i8 z - :start
* P, y( X, {0 P - cls " A- H$ v) \) c
- ECHO ================================
1 C# N/ X* D* Y9 f3 z - ECHO 请选择要换的ip & S0 v1 t8 x0 E2 g9 M
- ECHO ————————————————
2 d+ B# e. U2 g - echo 无线网络连接---自动获取IP地址…………1 9 ~/ g' S# }7 c3 f+ n7 M5 z4 O
- echo.
# e/ N; K2 y+ F) t - echo 无线网络连接---办公室IP配置……………2
$ ^( T# V% q7 b; r K - echo. 5 z$ _0 ?0 O. A- I& L4 _2 s
- echo 本地连接---自动获取IP地址………………3 / b" U; q0 F6 ^" X' ]
- echo.
: N5 G$ x- p: e3 r# T! Z5 w - echo 本地连接---办公室IP配置…………………4
$ x z) K6 H* n. X5 X& C8 G - echo.! w5 q) ~. Y! g8 w
- echo 退出…………………………………………5
* h$ @9 Q3 t/ \, }3 F* ~& w - echo.1 G) G1 I( p+ T3 B0 D
$ [3 U+ o/ M" z. H. u- ^$ \+ o$ `9 L- @set /p UserSelection=选择(1,2,3,4,5) 2 O3 T& b) {; ?& c+ z$ D5 t
- # l" s0 u4 h) H9 j k/ _4 \
- if %UserSelection% LEQ 5 if %UserSelection% GEQ 1 goto selection
4 M! H" b7 R1 l0 T7 D - goto start 8 k, U8 G3 ]+ P k
- _2 [8 r7 }2 x3 N$ m) L- :selection
+ r0 C7 R1 d2 A+ R! I - @if "%UserSelection%"=="1" goto 1 $ s: R% ]5 l; w- r
- @if "%UserSelection%"=="2" goto 2
]0 G# i. M! e2 K" n3 E- g - @if "%UserSelection%"=="3" goto 3
/ \& R( p ]1 s$ e3 O! L8 W - @if "%UserSelection%"=="4" goto 4- D9 q7 @% {3 k
- @if "%UserSelection%"=="5" goto 5
2 ?$ ?& H7 U8 s1 o7 a; `# I6 _) U2 S - : E* ~* P" R3 s( G8 N& ?5 o
- :1 y5 T8 f) `+ ?! R: {/ F! u7 H
- echo 无线网络连接---自动获取IP地址---请稍候...
$ v" ]2 k# p& v% t9 v1 t - netsh interface ip set address name="无线网络连接" source=dhcp
; z Z4 _+ h% D& w. p S - netsh interface ip set dns name="无线网络连接" source=dhcp
6 l) D% x) i6 V: _' r; L" |3 } - exit
( c; g9 D$ \* s3 g: b) l7 |
$ C) N( Z8 I0 [, j6 |/ `- :2
0 z) R" b5 T% V( } ? - echo 无线网络连接---办公室IP配置---请稍候...
A4 t1 O) N! B6 I: W5 o) c0 w - set ipaddress=192.168.0.100
# P! ?6 m6 d( c0 H# A- E2 M - set subnetmask=255.255.255.0
" w0 Y; f2 k, T1 v2 k - set defaultGateway=192.168.0.17 A$ `/ L% D$ X9 H: w
- set dns=202.96.98.369 v8 P8 `& u7 g4 c6 Q* G$ ]* ^
- netsh set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask% gateway=%defaultGateway% gwmetric=08 X# \+ q. S1 R, n) `! Q
- rem netsh interface ip set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask%1 Z2 q( r8 n9 J4 l. Y7 a
- rem netsh interface ip set address name="无线网络连接" gateway=%defaultGateway% gwmetric=0
9 E4 N( n) K: e: q8 t% m. X: F - netsh interface ip set dns name="无线网络连接" source=static addr=%dns% register=primary
# }0 W& M+ c/ x* R; B1 G4 F% I7 U! V - rem netsh interface ip set dns name="无线网络连接" source=static addr=%dns%
! z3 t6 A w4 {0 L/ [- y - exit
; s# U! V# u: h8 A+ O& u
" h6 I7 |- N G: J- :3
# P, u' d& l4 ^: m - echo 本地连接---自动获取IP地址---请稍候...* r1 [# ^9 w0 n5 R8 \
- netsh interface ip set address name="本地连接" source=dhcp; X% q0 m( L# j% e
- netsh interface ip set dns name="本地连接" source=dhcp/ F& q/ j2 L5 z* {5 j' C
- exit
! [0 ^9 u5 ]* _- B& Z
# @9 ^6 u; L T5 u8 [% c- :46 \) m2 g9 @8 \3 P) W2 }0 {7 b# F! m
- echo 本地连接---办公室IP配置---请稍候...
3 d: o8 P& _% ` - set ipaddress=192.168.1.68: ~% F4 @2 O: [9 e5 H' }
- set subnetmask=255.255.255.0
! j, ~- y& [" v4 W3 X, H1 C - set defaultGateway=192.168.1.1, z" V& l9 Y: O/ `- ^% Y
- set dns=202.102.128.68! R: [6 [( C6 ?6 b
- netsh interface ip set address name="本地连接" source=static addr=%ipaddress% mask=%subnetmask%
- ]/ \( i" u8 F - netsh interface ip set address name="本地连接" gateway=%defaultGateway% gwmetric=02 x2 [1 }* o* K; n
- netsh interface ip set dns name="本地连接" source=static addr=%dns% register=primary* N. t. v* Y, f) S! J5 Z$ G ]
- netsh interface ip set dns name="本地连接" source=static addr=%dns%
2 R* o* \' h) E5 q% c - exit0 x( w5 z3 a5 l# H2 _3 p2 m
# s; Y2 x' h2 G- :5
8 q4 G# d" W% t6 R3 D5 k/ y - echo 58 U1 l1 |9 W- x
复制代码 |
-
-
IP.bat
2.22 KB, 阅读权限: 1, 下载次数: 0
|