---
title: "Windows设置ip的脚本"
author: "taft"
date: "2013-05-06T22:03:38Z"
tags: []
categories: ["操作系统"]
slug: "windows-ip"
draft: false
lastmod: "2013-05-06T22:03:38Z"
id: 1860743
url: "https://taft.iteye.com/blog/1860743"
---

使用netsh设置静态ip地址：

@echo off 

netsh interface ip set address "本地连接" static 172.24.83.239 255.255.255.0 172.24.83.247

netsh interface ip set dns "本地连接" 172.24.102.110

netsh interface ip add dns "本地连接" 172.24.102.110 index=2

pause

使用netsh设置动态ip地址：

@echo off

netsh interface ip set address name="本地连接" source=dhcp

netsh interface ip set dns name="本地连接" source=dhcp

pause