Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

WIN7 sets IP, DNS, WINS through BAT script

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

This article uses BAT script to set network information such as IP on WIN7. The following is an example:

The following is the script: @ echo off%1% 2ver | find "5." > nul&&goto: stmshta _ vbscript:createobject ("shell.application"). Shellexecute ("% ~ S0", "goto: st", "", "runas" 1) (window.close) & goto: eof:stecho/title modifies the native IP address color 1fecho * echo * * echo * modify the local Nic IP address * echo * 1. Static address * echo * 2. Automatically get * echo *: beginset / p n = Please enter the type of network card to be set (1 or 2): if "% n%" lss "1" echo the network card you entered does not exist! Please re-enter! If "n" gtr "2" echo the network card you entered does not exist! Please re-enter! Echo/if "n%" lss "1" goto beginif "% n%" gtr "2" goto beginif "n%" equ "1" goto x1if "% n%" equ "2" goto x2:x1echo you chose:% n. Ethernet: begin1set / p a = Please enter static IP address (e.g. 192.168.1.2): if "% a%" equ "goto begin1:begin2set / p b = enter subnet mask (e.g. 255.255.255.0): if"% b% "equ"goto begin2:begin3set / p c = enter gateway address (e.g. 192.168.1.1): if"% c% "equ"goto begin3:begin4set / p d = enter DNS Address 1 (e.g. 114.114.114.114): if "% d%" equ "goto begin4:begin5set / p e = Please enter DNS address 2 (e.g. 211.138.156.66): if"% e% "equ"goto begin5:begin6set / p f = Please enter WINS address (e.g. 8.8.8.8): if"% f% "equ"goto begin6netsh interface ip set address" Local connection "static% a% b% c%netsh interface ip set dns "Local connection" static d% primary > nulnetsh interface ip add dns "Local connection"% e% > nulnetsh interface ip set wins "Local connection" static% f% > nulecho static address set successfully!! ping-n 5 127.0.0.1 > nulgoto:eof:x2echo selected:% n. Automatic acquisition echo * echo * IP is about to be initialized to automatic acquisition state. * netsh interface ip set address "Local connection" dhcp > nulnetsh interface ip set dns "Local connection" dhcp > nulecho * echo DHCP set successfully!! ping-n 5 127.0.0.1 > nulgoto:eofpause

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report