标题: [其他] [已解决]如何提取TXT中指定的内容? [打印本页]
作者: yaojogd 时间: 2011-10-24 17:00 标题: [已解决]如何提取TXT中指定的内容?
本帖最后由 yaojogd 于 2011-10-24 20:55 编辑
文件事例内容
"JumboFrameSize"="0"
"LowPowerStateLinkSpeed"="0"
"PollIntervalInus"="0"
"PriorityVLANTag"="0"
"SegOffload"="0"
"WakeUpMagic"="0"
"WakeUpPattern"="0"
"InfPath"="oem6.inf"
"InfSection"="NVENET_XPNPR.NDI"
"InfSectionExt"=".NT"
"ProviderName"="NVIDIA"
"DriverDateData"=hex:00,80,73,8a,69,f3,c8,01
"DriverDate"="8-1-2008"
"DriverVersion"="67.8.9.0"
"MatchingDeviceId"="{1a3e09be-1e45-494b-9174-d7385b45bbf5}\\nvnet_dev0057"
"DriverDesc"="NVIDIA nForce 10/100/1000 Mbps Ethernet "
"NetCfgInstanceId"="{A9F0C927-1EC0-495A-A141-AD1104871D4C}"
只需要提取"NetCfgInstanceId"="{A9F0C927-1EC0-495A-A141-AD1104871D4C}"中的{A9F0C927-1EC0-495A-A141-AD1104871D4C}到txt
作者: sxw 时间: 2011-10-24 19:38
你的意思是只提取最后一行吗?
作者: CrLf 时间: 2011-10-24 19:49
- @echo off
- for /f "tokens=1*delims==" %%a in (1.txt) do set str=%%~b
- echo %str%
- pause
复制代码
或者- @echo off
- for /f tokens^=3delims^=^" %%a in (1.txt) do set str=%%a
- echo %str%
- pause
复制代码
作者: yaojogd 时间: 2011-10-24 20:11
不是呢`是"NetCfgInstanceId"="{A9F0C927-1EC0-495A-A141-AD1104871D4C}"中的{A9F0C927-1EC0-495A-A141-AD1104871D4C}这段,这短不是固定这些表达,但是长度是一样的
这个是注册表中网卡的代码
作者: 920168 时间: 2011-10-24 20:16
- echo off
- for /f "tokens=1*delims==" %%a in ('type "10.txt"^|findstr "NetCfgInstanceId"') do set str=%%~b
- echo %str%>new.txt
- pause
复制代码
作者: yaojogd 时间: 2011-10-24 20:19
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0001]
"NewDeviceInstall"=dword:00000000
"NetCfgInstanceId"="{29898C9D-B0A4-4FEF-BDB6-57A562022CEE}"
"*IfType"=dword:00000083
"Characteristics"=dword:00000029
"*MediaType"=dword:0000000c
"*PhysicalMediaType"=dword:00000000
"NetLuidIndex"=dword:00000001
"DeviceInstanceID"="ROOT\\MS_AGILEVPNMINIPORT\\0000"
"InstallTimeStamp"=hex:db,07,07,00,06,00,09,00,0c,00,02,00,27,00,3e,03
"MinWanEndpoints"=dword:00000000
"MaxWanEndpoints"=dword:00000003
"WanEndpoints"=dword:00000002
"ComponentId"="ms_agilevpnminiport"
"InfPath"="netavpna.inf"
"InfSection"="Ndi-Mp-AgileVpn"
"ProviderName"="Microsoft"
"DriverDateData"=hex:00,80,8c,a3,c5,94,c6,01
"DriverDate"="6-21-2006"
"DriverVersion"="6.1.7601.17514"
"MatchingDeviceId"="ms_agilevpnminiport"
"DriverDesc"="WAN Miniport (IKEv2)"
作者: yaojogd 时间: 2011-10-24 20:26
我用regedit /e j:\11.txt HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0001
把内容放在11.txt里,在想把里面"NetCfgInstanceId"后面的{29898C9D-B0A4-4FEF-BDB6-57A562022CEE}输出到另一个文件里,比如2.txt
作者: 920168 时间: 2011-10-24 20:32
回复 7# yaojogd
更新顶楼!- echo off
- for /f "tokens=1*delims==" %%a in ('type "j:\11.txt"^|findstr "NetCfgInstanceId"') do set str=%%~b
- echo %str%>j:\2.txt
- pause
复制代码
作者: yaojogd 时间: 2011-10-24 20:54
谢谢楼上,额``字数补丁
作者: zaixinxiangnian 时间: 2011-10-24 22:29
- @echo off
- for /f "tokens=1,2 delims==" %%a in ('findstr "NetCfgInstanceId" a.txt') do echo %%~b
- pause
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |