无忧启动论坛
标题:
如何从文本中取出字符串
[打印本页]
作者:
2011xiaobing
时间:
2013-4-28 11:05
标题:
如何从文本中取出字符串
本帖最后由 2011xiaobing 于 2013-4-29 15:31 编辑
有一文本:
ImageX Tool for Windows
Copyright (C) Microsoft Corp. All rights reserved.
Version: 6.2.9200.16384
Image Information:
------------------
<IMAGE INDEX="1">
<DIRCOUNT>13394</DIRCOUNT>
<FILECOUNT>63690</FILECOUNT>
<TOTALBYTES>9557168251</TOTALBYTES>
<HARDLINKBYTES>3832683881</HARDLINKBYTES>
<CREATIONTIME>
<HIGHPART>0x01CE2F64</HIGHPART>
<LOWPART>0x04B3C85E</LOWPART>
</CREATIONTIME>
<LASTMODIFICATIONTIME>
<HIGHPART>0x01CE2F64</HIGHPART>
<LOWPART>0x219327F6</LOWPART>
</LASTMODIFICATIONTIME>
<WINDOWS>
<ARCH>0</ARCH>
<PRODUCTNAME>Microsoft® Windows® Operating System</PRODUCTNAME>
<EDITIONID>Professional</EDITIONID>
<INSTALLATIONTYPE>Client</INSTALLATIONTYPE>
<SERVICINGDATA>
<GDRDUREVISION>0</GDRDUREVISION>
<PKEYCONFIGVERSION>6.3.9374.0;2013-03-30T07:34:19Z</PKEYCONFIGVERSION>
</SERVICINGDATA>
<HAL>acpiapic</HAL>
<PRODUCTTYPE>WinNT</PRODUCTTYPE>
<PRODUCTSUITE>Terminal Server</PRODUCTSUITE>
<LANGUAGES>
<LANGUAGE>en-US</LANGUAGE>
<DEFAULT>en-US</DEFAULT>
</LANGUAGES>
<VERSION>
<MAJOR>6</MAJOR>
<MINOR>3</MINOR>
<BUILD>9374</BUILD>
<SPBUILD>0</SPBUILD>
<SPLEVEL>0</SPLEVEL>
</VERSION>
<SYSTEMROOT>WINDOWS</SYSTEMROOT>
</WINDOWS>
<NAME>Windows 8 Pro</NAME>
<DESCRIPTION>Windows 8 Pro</DESCRIPTION>
<FLAGS>Professional</FLAGS>
<DISPLAYNAME>Windows 8.1 Pro Preview</DISPLAYNAME>
<DISPLAYDESCRIPTION>Windows 8.1 Pro Preview</DISPLAYDESCRIPTION>
</IMAGE>
复制代码
要求:用一CMD批处理,取出字符串:6 ,3,9374,0,0,Professional,Windows 8.1 Pro Preview
分别赋给变量:MAJOR,MINOR,BUILD,SPBUILD,SPLEVEL,FLAGS,DISPLAYNAME
谢谢
感谢 PZNPT 大师!!!
作者:
pznpt
时间:
2013-4-28 21:02
@echo off
set "re=MAJOR MINOR BUILD SPBUILD SPLEVEL FLAGS DISPLAYNAME"
for /f "delims=" %%i in ('findstr /i "<%re: => <%>" a.txt') do (
for /f "tokens=2,3delims=<>" %%a in ("a%%i") do set "%%a=%%b"
)
set
pause
复制代码
作者:
2011xiaobing
时间:
2013-4-29 15:04
太感谢大师!
每每得到大师指导。十分感激。
欢迎光临 无忧启动论坛 (http://bbs.wuyou.net/)
Powered by Discuz! X3.3