Batch file 获取列信息的命令

Batch file 获取列信息的命令,batch-file,Batch File,我有一个命令incmd version,它生成以下输出 All Rights Reserved. This Software is protected by U.S. Patent Numbers 5,794,246; 6,014,670; 6,016,50 1; 6,029,178; 6,032,158; 6,035,307; 6,044,374; 6,092,086; 6,208,990; 6,339,775; 6,640,226; 6,789,096; 6,820,077; 6,823,3

我有一个命令
incmd version
,它生成以下输出

All Rights Reserved.
This Software is protected by U.S. Patent Numbers 5,794,246; 6,014,670; 6,016,50
1; 6,029,178; 6,032,158; 6,035,307; 6,044,374; 6,092,086; 6,208,990; 6,339,775;
6,640,226; 6,789,096; 6,820,077; 6,823,373; 6,850,947; 6,895,471; 7,117,215; 7,1
62,643; 7,254,590; 7,281,001; 7,421,458; 7,496,588; 7,523,121; 7,584,422; 7,720,
842; 7,721,270; and 7,774,791, international Patents and other Patents Pending.

Version: 9.1.0 HotFix2
Build: 1668 - 2011-Sep-02
Command ran successfully.
我想从中获取
9.1.0
。到目前为止,使用
findstr“Version”
我只得到
Version:9.1.0hotfix2
是否有办法提取列信息


注意:不使用任何第三方工具。。(windows中默认可用的任何工具都可以)

您可以使用
for
标记该输出:

for /f "tokens=2, delims= " %v in ('incmd version ^| findstr Version') do @set Version=%v
echo %Version%
有关该命令及其选项的详细说明,请参见帮助

请注意,如果在批处理文件中使用此选项(起初我假设,但显然不是这样),则必须将
for
变量中的百分比符号加倍:

for /f "tokens=2, delims= " %%v in ('incmd version ^| findstr Version') do @set Version=%%v
echo %Version%

它给我提供的
%%v此时是意外的。
如果在批处理文件中使用,则必须使用
%%v
。如果您只是从命令行进行测试,只需使用
%v