批处理高手 进来帮忙,字符串处理(高分)
========================================需要处理的文本====================================
PCI\VEN_1000&DEV_0054&SUBSYS_197615AD&REV_01\4&1F16FEF7&0&00A8: LSI Adapter, SAS 3000 series, 8-port with 1068
PCI\VEN_1274&DEV_1371&SUBSYS_13711274&REV_02\4&3AD87E0A&0&1888: VMware VMaudio (VMAUDIO) (WDM)
PCI\VEN_15AD&DEV_0405&SUBSYS_040515AD&REV_00\3&2B8E0B4B&0&78: VMware SVGA 3D (Microsoft Corporation - WDDM)
PCI\VEN_15AD&DEV_0740&SUBSYS_074015AD&REV_10\3&2B8E0B4B&0&3F: VMware VMCI Bus Device
PCI\VEN_15AD&DEV_0770&SUBSYS_077015AD&REV_00\4&3AD87E0A&0&2088: Standard Enhanced PCI to USB Host Controller
PCI\VEN_15AD&DEV_0790&SUBSYS_079015AD&REV_02\3&2B8E0B4B&0&88: PCI standard PCI-to-PCI bridge
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&A8: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&A9: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&AA: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&AB: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&AC: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&AD: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&AE: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&AF: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&B0: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&B1: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&B2: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&B3: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&B4: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&B5: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&B6: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&B7: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&B8: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&B9: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&BA: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&BB: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&BC: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&BD: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&BE: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&BF: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&C0: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&C1: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&C2: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&C3: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&C4: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&C5: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&C6: PCI Express standard Root Port
PCI\VEN_15AD&DEV_07A0&SUBSYS_07A015AD&REV_01\3&2B8E0B4B&0&C7: PCI Express standard Root Port
PCI\VEN_8086&DEV_100F&SUBSYS_075015AD&REV_01\4&3AD87E0A&0&0888: Intel(R) PRO/1000 MT Network Connection
PCI\VEN_8086&DEV_100F&SUBSYS_075015AD&REV_01\4&3AD87E0A&0&1088: Intel(R) PRO/1000 MT Network Connection #2
PCI\VEN_8086&DEV_100F&SUBSYS_075015AD&REV_01\4&3AD87E0A&0&3088: Intel(R) PRO/1000 MT Network Connection #3
PCI\VEN_8086&DEV_7110&SUBSYS_197615AD&REV_08\3&2B8E0B4B&0&38: Intel 82371AB/EB PCI to ISA bridge (ISA mode)
PCI\VEN_8086&DEV_7111&SUBSYS_197615AD&REV_01\3&2B8E0B4B&0&39: Intel(R) 82371AB/EB PCI Bus Master IDE Controller
PCI\VEN_8086&DEV_7112&SUBSYS_197615AD&REV_00\4&3AD87E0A&0&0088: Intel(R) 82371AB/EB PCI to USB Universal Host Controller
PCI\VEN_8086&DEV_7190&SUBSYS_197615AD&REV_01\3&2B8E0B4B&0&00: Intel 82443BX Pentium(R) II Processor to PCI Bridge
PCI\VEN_8086&DEV_7191&SUBSYS_00000000&REV_01\3&2B8E0B4B&0&08: Intel 82443BX Pentium(R) II Processor to AGP Controller
46 matching device(s) found.
============================================================================================
上面是电脑的PCI插槽的硬件ID,我要从这堆文字中得到网卡的ID里在\与&之间区别于其他ID的字符串,比如我这里的话就是:PCI\VEN_8086&DEV_100F&SUBSYS_075015AD&REV_01\4&3AD87E0A&0&0888: Intel(R) PRO/1000 MT Network Connection中的红色部分,
用批处理将其帅选出来
[解决办法]
假设文本文件为a.txt
@echo offsetlocalfor /f "tokens=2 delims=&" %%a in (a.txt) do ( if not defined %%a ( set %%a=1 echo %%a ) )endlocalpause
[解决办法]