|
|
设置IP是个比较费劲的事,那么有没有比较简单的方法一键设置呢?
# O- w' n, E0 w+ ]: B* L9 r5 y4 p9 p- S% `" r) Z- u- u
将以下文件复制到新建的文本文档的,然后另存为IP.bat文件,双击运行,根据情况选择。IP地址可以改成适合自己设置的。- @echo off9 m$ u0 o# H9 B; [1 Z4 z
- title 自动设置ip
$ n3 n# h6 C. h5 E" |9 Q& F- | - echo4 M* F) a& i/ b/ p e" V6 J% B
- :start
7 g6 g/ K, c8 D3 [ - cls
: v! q2 {/ L7 c4 {2 ^5 H - ECHO ================================
9 w+ e) n3 S7 E1 U - ECHO 请选择要换的ip * ?7 V1 B3 Z, ?5 e$ E
- ECHO ————————————————
( r3 b: u8 F, s3 b" r: Y% Y - echo 无线网络连接---自动获取IP地址…………1 . x* U# R) F7 o, n
- echo.
0 e- M& y& I1 } - echo 无线网络连接---办公室IP配置……………2
! X9 A1 g$ V" C8 s, m8 Z - echo.
0 t: D3 p; r/ F. a - echo 本地连接---自动获取IP地址………………3
& U( K }3 p) Q - echo. 5 c6 ?6 u o" }+ w% E2 h3 ]: P3 X# f
- echo 本地连接---办公室IP配置…………………4
7 e. \$ h0 T6 ~0 O: W - echo.
c4 c: \4 T+ r - echo 退出…………………………………………5
1 w" C$ Y7 ?+ }" _. t - echo.
, R; a' A- x. j9 N
5 K Q2 Q/ [! x* H- N' m- @set /p UserSelection=选择(1,2,3,4,5)
3 W. h& J6 v, p) }; C2 |
$ h4 D f5 Q6 F E- if %UserSelection% LEQ 5 if %UserSelection% GEQ 1 goto selection - W1 t! p/ I) Z; B' A+ f
- goto start + c$ M6 k5 W/ r5 {4 r
- 7 c2 D( j# `: f' w7 M: o
- :selection
$ N' q" H3 C: G1 A7 M/ X: ^1 T - @if "%UserSelection%"=="1" goto 1 4 _ N0 H9 l( S2 Q/ c! C
- @if "%UserSelection%"=="2" goto 2% p3 z% A4 X5 k& K3 ^" u6 Y+ ^2 [
- @if "%UserSelection%"=="3" goto 3 R4 M4 x4 z( }' ]( \- p
- @if "%UserSelection%"=="4" goto 4& P2 P* c2 m5 |! o
- @if "%UserSelection%"=="5" goto 5
/ n9 I' N. l2 w4 Z u
! U3 S) I# T9 A. d# \ U- :13 ?% I( ~" Z0 \$ w( W/ a/ U& r! A
- echo 无线网络连接---自动获取IP地址---请稍候...9 x* J8 z* b F" T- U0 y! m
- netsh interface ip set address name="无线网络连接" source=dhcp
) j/ }' S- a: a% U9 ^) |, U - netsh interface ip set dns name="无线网络连接" source=dhcp
, I9 J, e& r" Z5 g3 }! ^2 ] - exit3 U# A/ u. R; Y) V
- 8 a# a- X" j# |8 r8 q3 ^
- :24 ]4 M4 p/ S0 d) V
- echo 无线网络连接---办公室IP配置---请稍候...& z; v+ M2 ^" q. [
- set ipaddress=192.168.0.100
0 M6 G, ?* e$ Y4 x3 T3 }4 [1 f - set subnetmask=255.255.255.0" a8 s/ [4 r, }' U! R& I6 T
- set defaultGateway=192.168.0.14 v0 \1 x4 q+ O( Z7 @# j
- set dns=202.96.98.36
5 Q/ U- f. a- T - netsh set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask% gateway=%defaultGateway% gwmetric=0- E+ e( o- O4 j; i8 Z
- rem netsh interface ip set address name="无线网络连接" source=static addr=%ipaddress% mask=%subnetmask%: O1 ]% U- |9 A+ ]
- rem netsh interface ip set address name="无线网络连接" gateway=%defaultGateway% gwmetric=0
" F; Q, L# H1 F$ |( j3 G - netsh interface ip set dns name="无线网络连接" source=static addr=%dns% register=primary
' Q: N4 D/ D5 n( Y - rem netsh interface ip set dns name="无线网络连接" source=static addr=%dns%1 ?' G; k8 Q& a4 F9 w* e# @6 Y8 J
- exit
, ~" p2 \ a9 _8 z - % A0 Z% Q3 X6 n5 h/ j
- :38 k2 h) I6 n; d) p$ n
- echo 本地连接---自动获取IP地址---请稍候...8 V0 {8 t4 }8 O1 [1 v
- netsh interface ip set address name="本地连接" source=dhcp6 J$ X9 \8 I' w: ]& [
- netsh interface ip set dns name="本地连接" source=dhcp* C1 r9 C+ _! o( }1 }2 H) N. P
- exit
1 M+ U9 P; W X1 w2 H! F
" o9 {& C: K; X( _- :40 c6 X8 H3 D7 N' l/ ~- \% t: I/ n
- echo 本地连接---办公室IP配置---请稍候...
# d* `& O6 h h1 A) j - set ipaddress=192.168.1.68' a# Q7 j3 l, i- U2 k& R
- set subnetmask=255.255.255.09 S# v- l2 U3 k/ |
- set defaultGateway=192.168.1.1
7 r/ F. |. [+ e: `2 d+ Q( a - set dns=202.102.128.68
+ _" s) z! [/ P. t9 u - netsh interface ip set address name="本地连接" source=static addr=%ipaddress% mask=%subnetmask%5 B' \( S# i/ {9 a+ D
- netsh interface ip set address name="本地连接" gateway=%defaultGateway% gwmetric=0
( Z9 y, V* I9 }% c1 @$ h, j& ]. e* p8 z - netsh interface ip set dns name="本地连接" source=static addr=%dns% register=primary
$ W/ o- ]# l9 b3 f! E' s - netsh interface ip set dns name="本地连接" source=static addr=%dns%
4 P% I: K+ P( P - exit7 p3 x8 ?5 D, I
- $ G- B3 ~" D& v6 i
- :57 u* [$ Z1 o8 N! \! @
- echo 5: t$ z! f& l/ b& P, W
复制代码 |
-
-
IP.bat
2.22 KB, 阅读权限: 1, 下载次数: 0
|