|
|
设置IP是个比较费劲的事,那么有没有比较简单的方法一键设置呢?1 x8 G* G: {. u8 @. [0 Z
+ d, s' u' {" u! [将以下文件复制到新建的文本文档的,然后另存为IP.bat文件,双击运行,根据情况选择。IP地址可以改成适合自己设置的。- @echo off
4 J9 C7 J) P2 ~8 p, \ - title 自动设置ip! v7 J5 y) R" G; `+ ]: }
- echo& ^ C% _. d7 f+ q
- :start ; E: |$ j9 j6 [& e! Z5 Y: l4 ?
- cls
5 ~" k1 |. p( u0 ?! o - ECHO ================================ & u* ~' d5 w1 S0 ?( u
- ECHO 请选择要换的ip $ i' Q* H& N g7 w
- ECHO ————————————————
: w" f! ~" ^5 Q* V3 P, j' u - echo 无线网络连接---自动获取IP地址…………1
( ^0 z# R6 h) ^$ C4 b - echo. ' h' E: `+ \0 Z% [3 b2 n' ?9 A
- echo 无线网络连接---办公室IP配置……………2
$ [+ B4 @* Z& ?/ U4 Y. ]1 g - echo. & Y. z* u5 O$ d) t S0 X
- echo 本地连接---自动获取IP地址………………3
4 U% A, }" L7 U8 } - echo. 5 l* l+ [) {0 B, {) D+ N
- echo 本地连接---办公室IP配置…………………4- n* e9 M# K' ?6 g" i
- echo.
' a+ Z1 `$ Z6 h( K/ Z/ e8 H/ u5 p - echo 退出…………………………………………5
r/ f. e- O- ~ - echo.
, H% G5 A. P+ @: \" u& X
: F* ^: U, R& Z3 W' F- @set /p UserSelection=选择(1,2,3,4,5) $ _. A; k; N; _0 k. h8 ?4 _$ A% d
- - W2 r( z4 G! O) O
- if %UserSelection% LEQ 5 if %UserSelection% GEQ 1 goto selection
2 R6 u/ m" j% f - goto start / F5 g9 ]" f3 u+ m; a
- 8 w2 } [* a) W
- :selection
9 [( C2 K. R3 P7 O% M/ q/ W - @if "%UserSelection%"=="1" goto 1
) |2 q8 S' x% D n4 }4 t ~3 I - @if "%UserSelection%"=="2" goto 2
- `3 O& `$ z/ f" V - @if "%UserSelection%"=="3" goto 3
: P% m# B% w& [ - @if "%UserSelection%"=="4" goto 4* F& S" B& I R* O6 D7 |! J+ I' Q
- @if "%UserSelection%"=="5" goto 5* V1 U% [6 H. y! K6 Z _& q- T
- 3 T* N* h( A" ]' P$ T
- :1
9 e7 \9 x% R) k7 p3 V - echo 无线网络连接---自动获取IP地址---请稍候...2 X" J4 Y! ^3 A/ N& P" a
- netsh interface ip set address name="无线网络连接" source=dhcp( ]. q d- w7 t
- netsh interface ip set dns name="无线网络连接" source=dhcp
( M2 A; @5 t6 U' \' B3 S3 w' ]; X% ^ - exit
2 d/ x; ~% m4 L1 w% ~" F
4 M9 P X1 Z' a4 g- :2
5 q1 ]8 h" w; ^ - echo 无线网络连接---办公室IP配置---请稍候...
) R: u, C% X: x _: s4 ^ - set ipaddress=192.168.0.100
8 ~6 B9 S& T @! K2 Q, K - set subnetmask=255.255.255.0
% W3 c. v# n. q; _ - set defaultGateway=192.168.0.19 w3 S& I& A7 a* |/ r/ Z
- set dns=202.96.98.36
7 K! X: |- u1 B% B - netsh set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask% gateway=%defaultGateway% gwmetric=05 ^/ f# M7 I/ v. Z; ` L8 u
- rem netsh interface ip set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask%' ^3 Y* _' y& d( X8 X
- rem netsh interface ip set address name="无线网络连接" gateway=%defaultGateway% gwmetric=0
4 h! _) ~5 N/ X' S - netsh interface ip set dns name="无线网络连接" source=static addr=%dns% register=primary) Z; l* N0 @8 O& R/ Y6 ?4 d3 P( \
- rem netsh interface ip set dns name="无线网络连接" source=static addr=%dns%
. g: [2 L1 v( R9 v4 M - exit$ M8 H8 R/ t/ [7 i, V5 i# @
- 9 [2 c2 M3 B- g1 j7 B3 R8 t9 `5 V
- :3
& a5 j% Q& R; C' h - echo 本地连接---自动获取IP地址---请稍候...
' A. z: L2 `7 Z+ }9 i5 r, D5 h& R/ @( t - netsh interface ip set address name="本地连接" source=dhcp4 G3 ~( B6 L# k0 [
- netsh interface ip set dns name="本地连接" source=dhcp9 G0 u+ \& [- i% e6 P
- exit, C8 N9 Q/ D' n" W0 u
- & \" e, p- F9 {/ E* @
- :49 y0 @$ I& Q: U
- echo 本地连接---办公室IP配置---请稍候...
, K' \5 u; l$ ?" ~5 q) G6 w8 a - set ipaddress=192.168.1.68
+ _4 @; m3 E+ H* @, V5 v1 l- } - set subnetmask=255.255.255.0
5 F0 {7 u. ?' J - set defaultGateway=192.168.1.1
$ b6 X# ?8 f# T% M) u& U' I - set dns=202.102.128.68- `& k* r! W; R
- netsh interface ip set address name="本地连接" source=static addr=%ipaddress% mask=%subnetmask%* ^/ C8 V, [0 {
- netsh interface ip set address name="本地连接" gateway=%defaultGateway% gwmetric=0
# b, B. J; n+ V) r5 s+ M8 G - netsh interface ip set dns name="本地连接" source=static addr=%dns% register=primary' e8 Q, e o, X- [, J
- netsh interface ip set dns name="本地连接" source=static addr=%dns%5 m! s1 K; F R$ b
- exit
+ A0 k2 j9 m3 h/ f$ [
- h! E4 }& n$ d- :5
) g( j$ ]8 U6 S( ] - echo 5
! G% ?( Q0 \3 m0 t1 Q( L
复制代码 |
-
-
IP.bat
2.22 KB, 阅读权限: 1, 下载次数: 0
|