|
设置IP是个比较费劲的事,那么有没有比较简单的方法一键设置呢?2 Q' u, L% l# f7 d
- b5 F2 |. W2 R* ~$ s将以下文件复制到新建的文本文档的,然后另存为IP.bat文件,双击运行,根据情况选择。IP地址可以改成适合自己设置的。- @echo off
: k& r- B- C ^/ u7 b) f - title 自动设置ip1 L6 z9 x' s- P- S5 M0 E
- echo
, [% y8 E% n; Q2 s2 b2 @" N - :start
7 x+ S, J9 c9 A9 L3 R" R - cls ! k, [$ H: Q/ [# T% E6 ^, G
- ECHO ================================ . H5 U8 I, s( y! J6 g) e4 _0 c
- ECHO 请选择要换的ip
/ i7 \! Y4 e5 Q5 J/ ? - ECHO ———————————————— 6 v6 W u1 P$ b& v- E! q- m
- echo 无线网络连接---自动获取IP地址…………1 W# X$ ^" Y! b5 C0 S
- echo. $ {. \1 C7 S8 M" g- d9 P6 `
- echo 无线网络连接---办公室IP配置……………2
& i2 g( w3 E$ s4 X1 X* m! ] - echo. / Q9 I) {; V8 I1 T; C/ S4 L
- echo 本地连接---自动获取IP地址………………3
$ w" X( ]% R3 l7 a" C9 M - echo. 7 M6 X# W% f t3 F9 @' V
- echo 本地连接---办公室IP配置…………………4
# k' m$ a% b7 I+ T, y; c2 V: F - echo.
" C( T5 ^+ B$ {2 _! w: `1 t! n4 F - echo 退出…………………………………………5/ o, a) c7 ^! {2 r# X1 H
- echo.
- U, r* F* L1 n' }" n) t6 H( R2 H9 U - b, ]/ ?0 Z4 ]7 [5 k
- @set /p UserSelection=选择(1,2,3,4,5)
9 Z) J, \/ b( z/ X* I
% k, U& S. S/ B, Z; S- if %UserSelection% LEQ 5 if %UserSelection% GEQ 1 goto selection ( [6 q8 j- \9 |% B! V r
- goto start
2 N2 I/ T' S4 f" q
/ _2 H2 P. H' f- Y% X- :selection
% }( m3 S2 V5 h% e/ K8 b - @if "%UserSelection%"=="1" goto 1
r3 M1 ]% E7 d - @if "%UserSelection%"=="2" goto 2
h( A' P0 s2 t, B1 t g' Y. r - @if "%UserSelection%"=="3" goto 3 - }# p1 W+ E$ e
- @if "%UserSelection%"=="4" goto 4: f* j) x6 k+ p' _0 m: D/ r
- @if "%UserSelection%"=="5" goto 5
9 o% r' ?5 j' |8 x4 n: h6 @$ V$ r" | - 2 c! E c2 K0 G
- :1
) U- Q7 }& K" P5 P6 s1 l - echo 无线网络连接---自动获取IP地址---请稍候...
/ n+ }3 u8 b7 V; j0 U+ x7 L: B0 ? - netsh interface ip set address name="无线网络连接" source=dhcp
& n5 m" {7 k& g - netsh interface ip set dns name="无线网络连接" source=dhcp7 L8 k6 d# N; P# k" {
- exit
& S1 i$ Y& p' Z/ i' f6 L5 c" `* ]$ g
1 n4 _9 q5 R, r% q3 Z* M- :2
% g$ x# J h8 S3 W1 I - echo 无线网络连接---办公室IP配置---请稍候...
- ~ u4 C" n8 F$ L4 D! q4 a1 n - set ipaddress=192.168.0.100
3 K4 M* |9 j4 p5 h$ m4 o - set subnetmask=255.255.255.0; B' D* ~! {1 }
- set defaultGateway=192.168.0.1: S! J7 K! z( H% |8 c6 ~5 m3 O
- set dns=202.96.98.368 I F8 {8 W& m
- netsh set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask% gateway=%defaultGateway% gwmetric=0
# |3 i* d0 @: |" @ - rem netsh interface ip set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask%* ]# Z! P2 y' b9 o8 p: O
- rem netsh interface ip set address name="无线网络连接" gateway=%defaultGateway% gwmetric=0
0 K! b( g+ p/ k/ J - netsh interface ip set dns name="无线网络连接" source=static addr=%dns% register=primary& ^) o5 o8 @& X0 c, S1 _. P& ~
- rem netsh interface ip set dns name="无线网络连接" source=static addr=%dns% B' V) y% `6 N1 H6 b S
- exit
% x1 P0 p; \8 f9 t - / g0 F: J+ K) u. U& O5 h2 |
- :3
# F7 P7 @& }- i3 n, k" ^ - echo 本地连接---自动获取IP地址---请稍候...) B9 t) q c5 t8 h+ x8 _# n1 V
- netsh interface ip set address name="本地连接" source=dhcp
3 @3 x! V' Q7 v1 H/ Y$ J3 h( m - netsh interface ip set dns name="本地连接" source=dhcp9 m: x4 z, u7 ?! ~: m
- exit* _' Q8 }+ I* _. H
7 V. M. ?, p; D- :4
: `% Q& A3 C K W5 j* h7 U% H/ m - echo 本地连接---办公室IP配置---请稍候...% B2 z' s5 u" n. o
- set ipaddress=192.168.1.683 i: g9 R/ B& M5 ]7 C
- set subnetmask=255.255.255.0
/ L2 [ C; J( }1 L4 y8 N- v - set defaultGateway=192.168.1.1; i& |5 @( X) s: Y# ?
- set dns=202.102.128.68
- Z* \" C4 Q8 K( O# M - netsh interface ip set address name="本地连接" source=static addr=%ipaddress% mask=%subnetmask%- R4 b$ R0 d$ t4 Z+ }+ s6 J8 ?7 K" _! g
- netsh interface ip set address name="本地连接" gateway=%defaultGateway% gwmetric=05 g( G: y3 {6 d+ u+ V) V
- netsh interface ip set dns name="本地连接" source=static addr=%dns% register=primary* V' Q! G: c/ I3 ?
- netsh interface ip set dns name="本地连接" source=static addr=%dns%
% ~6 g: P1 S I9 p, g9 F - exit% V4 b, q. B5 D% o
+ P V/ a5 F( k# V1 \2 W) k. S- :5
, F4 N4 c1 f2 B: N+ j1 {: C - echo 5
: Y( C. R3 |) R9 [% u* H
复制代码 |
-
-
IP.bat
2.22 KB, 阅读权限: 1, 下载次数: 0
|