吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 760|回复: 6
收起左侧

[资源求助] 求一个一键修改子网掩码、网关的小工具

[复制链接]
shyin 发表于 2024-1-8 16:52
25吾爱币
求一个一键修改子网掩码 网关的小工具  批处理或者VBS都可  要求操作系统版本win10 win7 能正常使用

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

pea 发表于 2024-1-8 17:36
 楼主| shyin 发表于 2024-1-8 20:58
pea 发表于 2024-1-8 17:36
https://www.52pojie.cn/forum.php?mod=viewthread&tid=1831802&highlight=IP%B5%D8%D6%B7

我不需要手动切换的
Batcher 发表于 2024-1-8 21:48
能否举例描述一下按照什么规律修改?最好配上截图。
 楼主| shyin 发表于 2024-1-8 23:04
Batcher 发表于 2024-1-8 21:48
能否举例描述一下按照什么规律修改?最好配上截图。

只要去能一键修改网关以及子网掩码即可,其他地址我不需要改动
matxi 发表于 2024-12-7 19:29
[Visual Basic] 纯文本查看 复制代码
01
02
03
04
05
06
07
08
09
10
11
12
Set objShell = CreateObject("WScript.Shell")
adapter = "Ethernet"  ' 修改为你的网络适配器名称
gateway = "192.168.1.1"  ' 修改为你想要设置的网关
subnet = "255.255.255.0"  ' 修改为你想要设置的子网掩码
 
' 设置子网掩码
objShell.Run "netsh interface ipv4 set subinterface """ & adapter & """ mask=" & subnet, 0, True
 
' 设置网关
objShell.Run "netsh interface ipv4 set address name=""" & adapter & """ gateway=" & gateway, 0, True
 
WScript.Echo "设置完成!"


这是一个vb
[Bash shell] 纯文本查看 复制代码
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
@echo off
:: 设置网络适配器名称,替换为你的网络适配器的实际名称
set adapter="Ethernet"
 
:: 设置新的网关和子网掩码
set gateway=192.168.1.1
set subnet=255.255.255.0
 
:: 修改子网掩码
netsh interface ipv4 set subinterface %adapter% mask=%subnet%
 
:: 修改网关
netsh interface ipv4 set address name=%adapter% gateway=%gateway%
 
echo 设置完成!
pause


这是一个bat
willieny 发表于 2024-12-9 01:29
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
netsh interface ip set address "以太网" static 192.168.0.99 255.255.255.0 192.168.0.1

说明:
1、第一行为自动取得管理员权限,如省略第一行,则需要在运行bat时右键,选择以管理员身份运行。
2、第二行”以太网“中,需要在网络连接中查看连接名称,如需要修改的连接为”以太网 2“,刚改为”以太网 2“
3、static后面内容依次为IP地址,子网掩码,默认网关,注意有空格连接

恢复DHCP脚本如下,同样需要修改网络连接名称:


%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
netsh interface ip set address "以太网" dhcp


Win10 64 LTSC测试成功
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2025-5-17 12:22

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

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