![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-08-04 20:51 |
共 48,038 主题排行 / 350,123 发帖 / 今日 0 篇 / 48,251 会员排行 |
| DOS批处理 & 脚本技术(批处理室) » [求助]如何在多个文本中提取字段,并添加到另一文本中? |
| 可打印版本 709 / 2 |
| 第1楼 ITU | 发表于 2007-06-04 23:46 |
| 中级用户 发帖 82 积分 209 | |
|
[求助]如何在多个文本中提取字段,并添加到另一文本中? 如在多台电脑上用"IPCONFIG /ALL >%COMPUTERNAME%.TXT"命令在不同电脑上收集到多个文本文件,如:
user1.txt 的内容如下: ------------------------------------------------------------------------- Windows IP Configuration Host Name . . . . . . . . . . . . : USER1 Primary Dns Suffix . . . . . . . : dime Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No Ethernet adapter 本地连接 2: Media State . . . . . . . . . . . : Media disconnected Description . . . . . . . . . . . : 3Com EtherLink XL 10/100 PCI TX NIC (3C905B-TX) Physical Address. . . . . . . . . : 00-01-02-90-48-60 Dhcp Enabled. . . . . . . . . . . : No IP Address. . . . . . . . . . . . : 192.168.0.1 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.0.100 DNS Servers . . . . . . . . . . . : 202.96.134.188 ------------------------------------------------------------------------- ; USER2.TXT的内容: ------------------------------------------------------------------------- Windows IP Configuration Host Name . . . . . . . . . . . . : USER2 Primary Dns Suffix . . . . . . . : dime Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No Ethernet adapter 本地连接: Media State . . . . . . . . . . . : Media disconnected Description . . . . . . . . . . . : Accton EN1207D-TX PCI Fast Ethernet Adapter Physical Address. . . . . . . . . : 00-10-B5-BE-28-8D Dhcp Enabled. . . . . . . . . . . : No IP Address. . . . . . . . . . . . : 192.168.0.2 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.0.100 DNS Servers . . . . . . . . . . . : 202.96.134.188 ------------------------------------------------------------------------- 如何通过批处理,将Host Name 、Primary Dns Suffix 、Physical Address、IP Address等字段后的结果提取出来,并添加到一个文本文件中,如以下内容: Host Name ; Primary Dns Suffix ;Physical Address ; IP Address USER1 ; dime ;00-01-02-90-48-60 ; 192.168.0.1 USER2 ; dime ;00-10-B5-BE-28-8D ; 192.168.0.2 [ Last edited by ITU on 2007-6-4 at 11:48 PM ] |
|
| 第2楼 lxmxn | 发表于 2007-06-05 01:16 |
| 版主 发帖 4,938 积分 11,386 | |
| 第3楼 ITU | 发表于 2007-06-06 01:58 |
| 中级用户 发帖 82 积分 209 | |
|
谢谢 lxmxn版主 , 搞定啦!
我还要继续学习FOR命令才行啊, 没想到FOR命令这么好用, 之前写了好长的批处理都没搞定, lxmxn版主一段程序就解决了我的问题啊! |
|
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |