佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1198|回复: 3

在batch script 里 - 如何写net command - 要写换ip address script

[复制链接]
发表于 7-4-2015 05:25 PM | 显示全部楼层 |阅读模式
command 已经有前任高手给了.如下,

open administrator cmd
-netsh
-interface ip config
-interface ip set address name="local area connection" static 15.0.2.22 255.0.0.0 15.0.2.180
-interface ip set dns "local area connection" static 15.0.0.2



要如何的把他改为batch script给用户double click 就好。
回复

使用道具 举报


ADVERTISEMENT

发表于 7-4-2015 08:10 PM | 显示全部楼层

  1. @echo off
  2. netsh interface ip set address name="local area connection" static 15.0.2.22 255.0.0.0 15.0.2.180
  3. netsh interface ip set dns "local area connection" static 15.0.0.2
复制代码


save 成 .bat 文件
然后叫 user right click run as administrator
要不然你就自己开一个shortcut,在shortcut里面force run as admin
http://stackoverflow.com/questio ... s-run-as-admin-mode
回复

使用道具 举报

发表于 7-4-2015 08:59 PM | 显示全部楼层
folder option 里,hide extensions for known file types 取消打勾
要建立文件的地方/文件夹,滑鼠右击 〉new text document
打开文件,输入内容如下,然后储存

netsh interface ip set address "local area connection" static 15.0.2.22 255.0.0.0 15.0.2.180 1
netsh interface ip set dns "local area connection" static 15.0.0.2

把文件格式 txt 改成 cmd,完成

ps:一楼内容少了 gateway metric
回复

使用道具 举报

 楼主| 发表于 8-4-2015 03:41 PM | 显示全部楼层
谢谢两位大大无私教导。。。coding可以跑了。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 6-9-2025 03:23 PM , Processed in 0.350816 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表