|
|
设置IP是个比较费劲的事,那么有没有比较简单的方法一键设置呢?
# C4 W" J- H: |* _5 V& n/ a" f% A5 _8 W5 `3 I
将以下文件复制到新建的文本文档的,然后另存为IP.bat文件,双击运行,根据情况选择。IP地址可以改成适合自己设置的。- @echo off$ Y# y& |- r, Q! ]: s0 E* h
- title 自动设置ip5 ~, H6 V+ ^) K2 U) D% ]& T" o
- echo
1 X o6 Y1 p" [8 D- {+ U, A - :start R4 N! B4 k3 H& J5 T
- cls
' t- J& q" ~- S% O! Y! j% m* Q7 Y3 z1 Y2 @ - ECHO ================================ + u7 q: v" `- `6 Z$ `& @5 S
- ECHO 请选择要换的ip
. o; a& q* X @( x# ~7 B! L' x z - ECHO ————————————————
2 H$ D9 L1 v( W9 Y; X7 C - echo 无线网络连接---自动获取IP地址…………1
' d# l1 g ~1 S' L/ I1 A/ | - echo.
: C( c- n! \: E8 k$ n( H3 [ - echo 无线网络连接---办公室IP配置……………2 9 c. r7 z1 I$ l# p& f
- echo.
7 `& v# E; ? o - echo 本地连接---自动获取IP地址………………3
5 S5 h2 r [: F* d8 x2 ? - echo. # { r( R5 l4 s: V
- echo 本地连接---办公室IP配置…………………4
6 i0 p+ ]$ S. `6 S6 z. O; c - echo.
0 @8 ]; e5 v+ P! N( J4 e- M1 z1 H - echo 退出…………………………………………5
* e: W n& i& g: E" E6 n2 m - echo.4 R: I& r; x) N" ^; Q
3 M0 `' d& J( X) r. G5 |$ `- @set /p UserSelection=选择(1,2,3,4,5) . l! B0 s) y- c: b2 }* W+ ]1 I
- 4 ` q& S% B& @$ m5 Z7 }
- if %UserSelection% LEQ 5 if %UserSelection% GEQ 1 goto selection
/ G9 ~8 c8 p* Q4 E! u& P - goto start
$ \% i% \* w) t9 z, u0 X
3 u7 S/ c0 Q/ t' R- :selection 0 f% ?" j2 F( Q
- @if "%UserSelection%"=="1" goto 1
; \, a# ]6 [7 z/ _ - @if "%UserSelection%"=="2" goto 2) s' Z& i) r" e9 B
- @if "%UserSelection%"=="3" goto 3
* Q' e9 F& Z. ^0 c5 D9 ?6 G' ]3 Q - @if "%UserSelection%"=="4" goto 49 G8 H; r5 G& u
- @if "%UserSelection%"=="5" goto 5
' ?9 _. x5 z, k- e" j% S( H - ) R( o }: [* Y* J+ S
- :1# C5 v& W1 f- w% }
- echo 无线网络连接---自动获取IP地址---请稍候...
- p$ {4 ]4 a* _5 N+ m - netsh interface ip set address name="无线网络连接" source=dhcp/ R! Q3 W S% U' _. u
- netsh interface ip set dns name="无线网络连接" source=dhcp
( K" o3 q! @: v A5 {3 N - exit7 ^, {. f3 K+ V
- 6 b7 B( x7 n. }0 @3 e. ~7 O( W' j
- :2# H1 S3 G: t2 {
- echo 无线网络连接---办公室IP配置---请稍候...
. U# }4 j' o6 [ v- e - set ipaddress=192.168.0.1009 X8 a3 O' v1 E Z' N
- set subnetmask=255.255.255.0+ r! d8 Q U H+ m7 k
- set defaultGateway=192.168.0.1
* Y8 ~ o/ `, ]: d* i& f- H. u - set dns=202.96.98.36
* A& h2 @+ v" {' F8 S - netsh set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask% gateway=%defaultGateway% gwmetric=0
4 X4 {! Y3 \, y/ m( c7 R - rem netsh interface ip set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask%/ [; ]" w$ X$ d; n
- rem netsh interface ip set address name="无线网络连接" gateway=%defaultGateway% gwmetric=08 @8 K/ L0 p V" T g9 {
- netsh interface ip set dns name="无线网络连接" source=static addr=%dns% register=primary% }+ H9 y' j# c/ D/ \# j6 b ~2 S
- rem netsh interface ip set dns name="无线网络连接" source=static addr=%dns%
! l9 U1 M' O0 A - exit
9 F& F# { z, x3 w
( M; s) {5 R3 W8 p! u- :3: C0 Z7 z/ O# c* @3 v3 U v6 B
- echo 本地连接---自动获取IP地址---请稍候...
' v" ]4 q# W! t, o - netsh interface ip set address name="本地连接" source=dhcp
/ C1 w$ U1 f4 v V2 a - netsh interface ip set dns name="本地连接" source=dhcp
# R+ n- L9 Q- z3 N! J; I# |2 x - exit$ `% p) a' E' C J/ h. U
- ! P: y! | S R
- :4
9 i5 t6 {3 a8 O. h3 f& V$ f4 a& P - echo 本地连接---办公室IP配置---请稍候...
* `; [, A v' Q' X7 K - set ipaddress=192.168.1.68
M, T4 `1 B/ j. ` - set subnetmask=255.255.255.0# o F( {# J; W# D9 E; \ d
- set defaultGateway=192.168.1.1! L1 n- n" r K! P$ o- M" _/ Z
- set dns=202.102.128.681 [6 D3 h/ Z& v" \, p& O
- netsh interface ip set address name="本地连接" source=static addr=%ipaddress% mask=%subnetmask%
3 U& S8 Q3 S; O* U: H& ` - netsh interface ip set address name="本地连接" gateway=%defaultGateway% gwmetric=0
- ~6 U% P5 X& q% T! l. H T& ?1 L - netsh interface ip set dns name="本地连接" source=static addr=%dns% register=primary, i8 Y5 X/ _4 k" P4 W- i
- netsh interface ip set dns name="本地连接" source=static addr=%dns%
7 d4 g. E9 c+ P1 ?4 v0 `- Z - exit
, J& @" k3 V% I; U7 {- a
' B# i) Y6 c. ^+ [ y9 w& }8 T- :5
3 p1 L: i1 n5 U" U! i' o - echo 5
L! z8 E N1 U `& z9 D7 d+ K+ Q
复制代码 |
-
-
IP.bat
2.22 KB, 阅读权限: 1, 下载次数: 0
|