|
feixiang9911
初级用户
 
积分 34
发帖 16
注册 2007-4-23
状态 离线
|
『楼 主』:
关于P处理更改网卡IP的问题
使用 LLM 解释/回答一下
我在网吧每次刻完盘都是手动改IP和计算机名称==
最近做了一个P处理 自动更改IP和计算机名称
但是我想问以下:
有的电脑是2个网卡 他就回出来 本地连接 和 本地连接 2 甚至 本地连接 3
Netsh interface ip set address 本地连接 static 192.168.1.2 255.255.252.0 192.168.1.1 1
这个命令好象就不管用了
有没有什么办法如果测试 如果 本地连接 是通的 就设置 本地连接的IP为上面的IP
如果本地连接2是痛的 就更改本地连接2的IP呢
因为有的时候网线是乱插的 网卡查的插槽也不统一
就造成 好多本地连接出来
Last edited by feixiang9911 on 2007-4-29 at 12:22 AM ]
I always manually change the IP and computer name every time I burn a disc in the internet café.
Recently I made a P processing to automatically change the IP and computer name.
But I want to ask the following:
Some computers have 2 network cards, so there will be "Local Area Connection" and "Local Area Connection 2" or even "Local Area Connection 3".
The command "Netsh interface ip set address 本地连接 static 192.168.1.2 255.255.252.0 192.168.1.1 1" seems to not work.
Is there any way to test: if "Local Area Connection" is connected, set the IP of "Local Area Connection" to the above IP; if "Local Area Connection 2" is connected, change the IP of "Local Area Connection 2"? Because sometimes the network cables are inserted randomly, and the slots where the network cards are inserted are not uniform, resulting in many local connections appearing.
Last edited by feixiang9911 on 2007-4-29 at 12:22 AM ]
|
|
2007-4-29 00:18 |
|
|
honghunter
中级用户
  
积分 321
发帖 135
注册 2007-2-4
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
下面是猜想,没条件测试。
在有多个本地链接的机器上,dump一份Netsh interface ,然后通过修改它,再应用。应该能实现。
Below is a guess, no conditions to test.
On a machine with multiple local links, dump a Netsh interface, then modify it and apply. It should be achievable.
|

探讨批量下载与智能化的下载 |
|
2007-4-29 01:49 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
netsh intreface show interface|find "启用"|find "专用"
netsh intreface show interface|find "Enabled"|find "Private"
|
|
2007-4-29 02:20 |
|
|
feixiang9911
初级用户
 
积分 34
发帖 16
注册 2007-4-23
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
xiexie 我想我在试一试
但是你find "启用"| 没有用呀
因为就是没有连接上的 本地连接也都是启用的
find "专用" 这个找的是什么呀?
xiexie I'm thinking I'll try again
But you find "Enable" | it doesn't work because it's just not connected. The local connections are all enabled
What is "special" looking for?
|
|
2007-4-29 23:23 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
|
2007-4-30 01:05 |
|
|
feixiang9911
初级用户
 
积分 34
发帖 16
注册 2007-4-23
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
呵呵 你什么时候能想出来呀?
Heheh, when will you be able to figure it out?
|
|
2007-5-1 02:29 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
feixiang9911:
我提供的实例是错误的,那是筛选非LAN连接用的,若你电脑只有一块网卡的话,可以使用ipconfig命令来得到活动的连接名称
for /f "tokens=3 delims=: " %i in ('ipconfig^|find /i "adapter"') do echo %i
feixiang9911:
The example I provided is incorrect. That is for filtering non - LAN connections. If your computer has only one network card, you can use the ipconfig command to get the name of the active connection
for /f "tokens=3 delims=: " %i in ('ipconfig^|find /i "adapter"') do echo %i
|
|
2007-5-1 03:42 |
|
|
feixiang9911
初级用户
 
积分 34
发帖 16
注册 2007-4-23
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
我的是好多网卡 有的是CMOS关闭了集成网卡 那就只有一个网卡
有的CMOS网卡开的 就是2个网卡 ,而且要是2个网卡的话 都是启用的
只是网线有的插下面 有的插上面而已亚·?~
我就想设置插了网线的那个网卡的IP
你在帮我 看看
I have many network cards. Some have the integrated network card disabled in CMOS, so there is only one network card. If the CMOS network card is enabled, there are 2 network cards, and both are enabled if there are 2 network cards. It's just that the network cables are inserted below or above. I just want to set the IP of the network card with the network cable inserted. You help me take a look.
|
|
2007-5-1 06:10 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
网卡没有插网线不知在ipconfig下是否显示为活动,你可以测试一下,我机器不敢拔
I'm not sure whether it will be displayed as active under ipconfig if the network card isn't plugged in with a network cable. You can test it. I don't dare to unplug the cable on my machine.
|
|
2007-5-1 06:30 |
|
|
flyinspace
银牌会员
    
积分 1206
发帖 517
注册 2007-3-25
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
我是这样的代码没有条件测试。。
就不写出来了。怕丢人:)
I am like this code without conditional testing...
Just won't write it out. Afraid of being ashamed :)
|

知,不觉多。不知,乃求知 |
|
2007-5-1 06:41 |
|
|
csx163
初级用户
 
积分 97
发帖 45
注册 2007-1-31
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
没插网线的网卡显示的是 断开 只有 链接正常的网卡才显示 已连接上
The network card without an Ethernet cable plugged in shows "Disconnected", and only the network card with normal connection shows "Connected".
|
|
2007-5-1 12:33 |
|
|
feixiang9911
初级用户
 
积分 34
发帖 16
注册 2007-4-23
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
我试过了 没插网线 也显示的是活动的
各位大哥 难道这个问题没有办法解决吗?
`5`55`
I tried it. Even without plugging in the network cable, it still shows active.
Brothers, is there really no way to solve this problem?
`5`55
|
|
2007-5-2 17:05 |
|
|
everest79
金牌会员
      一叶枝头,万树皆春
积分 2564
发帖 1127
注册 2006-12-25
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
这个我没条件,不过你可以将各种网络相关的命令都测试一下,看下特征,例如nbtstat -a localhost之类的,都会列出当前连前与IP
I don't have the conditions for this, but you can test various network-related commands and see the characteristics, such as nbtstat -a localhost, which will list the current connections and IPs.
|
|
2007-5-3 15:46 |
|
|
chenall
银牌会员
    
积分 1276
发帖 469
注册 2002-12-23 来自 福建泉州
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
是只有一个会通吗?还是有可能有两个通,或全通呢?
如果是只有一个会通试试以下代码
原理,自己看一下代码应该可以明白
- @echo off
- for /f "usebackq tokens=1 delims=:" %%i in (`ipconfig^|findstr /n /c:"IP Address"`) do (
- for /f "usebackq tokens=1,3* delims=: " %%a in (`ipconfig^|findstr /n /c:"Ethernet adapter"`) do (
- if %%i GTR %%a (set 连接=%%c)
- )
- )
- set 连接=%连接::=%
- echo %连接%
- pause
chenall发表于: 2007-05-04 00:15
Is there only one Huiton? Or is it possible to have two Huitons, or all Huitons?
If there is only one Huiton, try the following code
The principle, you can understand by looking at the code yourself
- @echo off
- for /f "usebackq tokens=1 delims=:" %%i in (`ipconfig^|findstr /n /c:"IP Address"`) do (
- for /f "usebackq tokens=1,3* delims=: " %%a in (`ipconfig^|findstr /n /c:"Ethernet adapter"`) do (
- if %%i GTR %%a (set 连接=%%c)
- )
- )
- set 连接=%连接::=%
- echo %连接%
- pause
chenall posted on: 2007-05-04 00:15
|

QQ:366840202
http://chenall.net |
|
2007-5-4 00:16 |
|
|
qq43142691
中级用户
  
积分 327
发帖 152
注册 2007-5-4
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
@echo off
title 按照你本地的网卡名.自动修改网络DNS by 彬 QQ43142691
:::这里开始是获取网卡信息
@echo off&ipconfig /all >network.ini
:::这里开始判断网卡名
@echo off&find "本地连接" network.ini && set netcard=本地连接
@echo off&find "本地连接1" network.ini && set netcard=本地连接1
@echo off&find "本地连接2" network.ini && set netcard=本地连接2
@echo off&find "本地连接3" network.ini && set netcard=本地连接3
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::修改IP
set slection1=
set slection1=10.0.0.128
netsh interface ip set address name="%netcard%" source=static addr=%slection1% mask=255.255.252.0
::这里开始修改网关
set slection2=
set slection2=10.0.0.254
netsh interface ip set address name="%netcard%" gateway=%slection2% gwmetric=0
::开始修改DNS
@netsh interface ip set dns name="%netcard%" source=static addr=202.96.128.143
@netsh interface ip add dns name="%netcard%" addr=202.96.128.68 index=2
exit
Last edited by qq43142691 on 2007-5-3 at 06:05 PM ]
@echo off
title Automatically Modify Network DNS According to Your Local Network Card Name by Bin QQ43142691
::: Here starts getting network card information
@echo off&ipconfig /all >network.ini
::: Here starts judging network card name
@echo off&find "Local Area Connection" network.ini && set netcard=Local Area Connection
@echo off&find "Local Area Connection 1" network.ini && set netcard=Local Area Connection 1
@echo off&find "Local Area Connection 2" network.ini && set netcard=Local Area Connection 2
@echo off&find "Local Area Connection 3" network.ini && set netcard=Local Area Connection 3
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::Modify IP
set slection1=
set slection1=10.0.0.128
netsh interface ip set address name="%netcard%" source=static addr=%slection1% mask=255.255.252.0
::Here starts modifying gateway
set slection2=
set slection2=10.0.0.254
netsh interface ip set address name="%netcard%" gateway=%slection2% gwmetric=0
::Start modifying DNS
@netsh interface ip set dns name="%netcard%" source=static addr=202.96.128.143
@netsh interface ip add dns name="%netcard%" addr=202.96.128.68 index=2
exit
Last edited by qq43142691 on 2007-5-3 at 06:05 PM ]
|
|
2007-5-4 07:04 |
|