![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-08-08 13:18 |
共 47,811 主题排行 / 349,895 发帖 / 今日 0 篇 / 48,253 会员排行 |
| DOS批处理 & 脚本技术(批处理室) » 这个脚本运行不正常,哪点错了。 |
| 可打印版本 648 / 3 |
| 第1楼 sevenwang2000 | 发表于 2008-05-12 14:27 |
| 初级用户 发帖 8 积分 22 | |
|
这个脚本运行不正常,哪点错了。 @echo off
echo 当前网络配置如下: ipconfig /all echo 1.重新配置 echo 2.自动获取网络配置 echo 3.退出配置 set /p select=请选择任意一选项继续: if select=="1" goto select1 if select=="2" goto select2 if select=="3" goto select3 goto nothing :select1 set /p ip=请输入您的IP(格式为192.168.0.*): netsh interface ip set address name="本地连接" source=static address="%ip%" mask=255.255.255.0 gateway=192.168.0.254 netsh interface ip set dns name="本地连接" source=static 218.2.135.1 primary goto end :select2 netsh interface ip set address name="本地连接" source=dhcp netsh interface ip set dns name="本地连接" source=dhcp goto end :select3 goto end :nothing echo 你没有选择任何选项,程序将退出。 goto end :end pause [ Last edited by sevenwang2000 on 2008-5-12 at 02:29 PM ] |
|
| 第2楼 plp626 | 发表于 2008-05-12 14:41 |
| 银牌会员 发帖 1,020 积分 2,278 | |
|
select=="1"
改为 “%select%”=="1" 试试 |
|
| 第3楼 tvzml | 发表于 2008-05-12 15:59 |
| 初级用户 发帖 67 积分 157 | |
|
@echo off
echo 当前网络配置如下: ipconfig /all echo 1.重新配置 echo 2.自动获取网络配置 echo 3.退出配置 set /p select=请选择任意一选项继续: if %select%==1 goto select1 if %select%==2 goto select2 if %select%==3 goto select3 goto nothing :select1 set /p ip=请输入您的IP(格式为192.168.0.*): netsh interface ip set address name="本地连接" source=static address="%ip%" mask=255.255.255.0 gateway=192.168.0.254 netsh interface ip set dns name="本地连接" source=static 218.2.135.1 primary goto end :select2 netsh interface ip set address name="本地连接" source=dhcp netsh interface ip set dns name="本地连接" source=dhcp goto end :select3 goto end :nothing echo 你没有选择任何选项,程序将退出。 goto end :end pause |
|
| 第4楼 sevenwang2000 | 发表于 2008-05-12 18:51 |
| 初级用户 发帖 8 积分 22 | |
|
已经解决,IP和网关要分别设置
[ Last edited by sevenwang2000 on 2008-5-12 at 09:36 PM ] |
|
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |