|
设置IP是个比较费劲的事,那么有没有比较简单的方法一键设置呢?
2 r* ?, _7 c% [; V9 W, O) t" }
9 K7 N3 s9 m# r将以下文件复制到新建的文本文档的,然后另存为IP.bat文件,双击运行,根据情况选择。IP地址可以改成适合自己设置的。- @echo off( K1 V6 T- B) A$ E
- title 自动设置ip
9 v. q3 |, u' z8 M4 G f- L- X* Q - echo
; O4 q, r- y7 S, i, G/ W- b - :start * G T7 _. `- V7 x- ^2 Z
- cls - h# `$ @/ v8 g3 u
- ECHO ================================
3 ~9 t. e7 m8 o2 ?; m - ECHO 请选择要换的ip
- }; [! g2 f( |: C9 }' w5 A& D0 X - ECHO ————————————————
" s- X2 M0 d0 ~ W8 ?- _+ P5 u3 Y - echo 无线网络连接---自动获取IP地址…………1 $ x( Y. D& K- U0 c% R7 ]
- echo.
# ^+ }, H- u( W8 f0 ]; @, ~ - echo 无线网络连接---办公室IP配置……………2 $ Q( d6 V' }& J$ u& V& L9 F& B- O
- echo. * e8 B5 T5 r L7 T, f, G# n
- echo 本地连接---自动获取IP地址………………3 $ I4 }' h& o# b" W
- echo. 2 H( w8 E" A' M
- echo 本地连接---办公室IP配置…………………4. ~, m* [/ q4 }9 k2 I
- echo." c$ |4 l+ {6 d4 L# m+ m+ X1 v
- echo 退出…………………………………………5
7 H4 W0 v7 s0 v$ N1 s4 F* z - echo.7 f- r S' @" [
- * f+ A. C% q i# r/ l- q( V
- @set /p UserSelection=选择(1,2,3,4,5) / s9 i# V' X' R/ W
- 9 C5 A, m8 ]6 p2 C5 [6 W3 p# Q; [! E
- if %UserSelection% LEQ 5 if %UserSelection% GEQ 1 goto selection
8 b/ t8 h m$ \2 [ x) h, E% f0 I - goto start z# Z3 \2 d$ h$ u+ G
. E0 G. g8 z4 \) E! u0 i- :selection
5 S7 O0 n+ n$ j( L, |9 H. h - @if "%UserSelection%"=="1" goto 1
- U5 r/ j3 I" @5 \1 N" n - @if "%UserSelection%"=="2" goto 2) y+ F+ u" [2 E+ P
- @if "%UserSelection%"=="3" goto 3
6 r* ]$ v. d; c5 n. S - @if "%UserSelection%"=="4" goto 4
& b( L* A: k8 [( e - @if "%UserSelection%"=="5" goto 5* ?% V( H% a* R3 W+ ~7 X
- / h7 z5 h( J' m+ d2 I" s5 j
- :1
) R! m+ B. P+ | - echo 无线网络连接---自动获取IP地址---请稍候...6 T) ^0 O4 v0 U& J
- netsh interface ip set address name="无线网络连接" source=dhcp
0 `. D7 ~: O- Y# h. H3 e - netsh interface ip set dns name="无线网络连接" source=dhcp
' D( Z" O/ A4 z" u) T - exit
2 s/ J% N" a2 l* Z* D/ h - & K, ]0 l M% q* S0 q8 D& N
- :2
8 N4 E7 e& R6 r* h' Y) I5 U2 `' b - echo 无线网络连接---办公室IP配置---请稍候...
% S7 m% U2 t9 T/ m- H - set ipaddress=192.168.0.100
4 C9 d1 V# w' e, s - set subnetmask=255.255.255.0
1 x7 U: s7 G- Z0 ~: K3 ~) O( \& v/ u - set defaultGateway=192.168.0.1
) `0 m* V: a4 p# g6 |4 R - set dns=202.96.98.362 O: L) y; ]7 E. m
- netsh set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask% gateway=%defaultGateway% gwmetric=0" k' Y: I0 F; V) \0 I' s
- rem netsh interface ip set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask%
5 C9 s# l2 I, K" [) j6 j1 K! ?& { - rem netsh interface ip set address name="无线网络连接" gateway=%defaultGateway% gwmetric=0
8 Y0 Q# i9 K- h9 M# v' B3 a - netsh interface ip set dns name="无线网络连接" source=static addr=%dns% register=primary
1 \& R+ v# v: W* h1 o: B - rem netsh interface ip set dns name="无线网络连接" source=static addr=%dns%
/ L, c4 e/ R" N6 y3 A% f3 q - exit) a: F+ e3 G% i7 Q
- & h" r/ Z6 }2 o+ c
- :39 G. e' g+ \# O% }
- echo 本地连接---自动获取IP地址---请稍候... r" p( n+ J D( Q& s
- netsh interface ip set address name="本地连接" source=dhcp
% I. F0 D% _1 ?" c8 R - netsh interface ip set dns name="本地连接" source=dhcp
1 I5 ?+ l" }, q. k. o b - exit
# M5 J7 F. Y2 ` - 4 x3 z$ g/ Q" l8 G U
- :44 ^1 x, q: Y6 D. p
- echo 本地连接---办公室IP配置---请稍候...
- V1 p8 x0 q2 L5 T: Y - set ipaddress=192.168.1.680 c. h T2 u4 a2 k2 u# j
- set subnetmask=255.255.255.0
2 O: _- y) `3 k" Z( a - set defaultGateway=192.168.1.1, _7 e6 M; t0 L+ B5 |
- set dns=202.102.128.68
7 O! D3 `/ b0 j# E5 C; m - netsh interface ip set address name="本地连接" source=static addr=%ipaddress% mask=%subnetmask%) V- p6 D: [1 |0 F$ C/ s
- netsh interface ip set address name="本地连接" gateway=%defaultGateway% gwmetric=0
$ T, ]; `2 g" X$ x* Q4 n: j - netsh interface ip set dns name="本地连接" source=static addr=%dns% register=primary
& c4 M) H' J- r3 e6 V+ Z8 k - netsh interface ip set dns name="本地连接" source=static addr=%dns%
( k" d( _- } o9 [4 ~8 H - exit
# R4 N# X' [5 b" h8 D* B% a9 ]: @ - 6 |) p$ t" z, P6 Q3 P
- :5
/ z2 r# ?1 f& P6 r/ S - echo 5! m3 d! ]7 [7 X6 R) {0 n
复制代码 |
-
-
IP.bat
2.22 KB, 阅读权限: 1, 下载次数: 0
|