覆盖率由assemblyPOroject A90%使用批处理文件
答
>find "%" name.txt
---------- NAME.TXT
Coverage by assemblyPOroject A90%
>set string=Coverage by assemblyPOroject A90%
>echo %string%
Coverage by assemblyPOroject A90%
>echo %string:~30,2%
90
如果您发现批处理语言的功能不足以达到您的要求 - 并且您可能不会花太多时间来达到该点 - 您可以使用Windows PowerShell。这并不是默认安装在所有版本的Windows上,但您可以免费下载。
如果你不喜欢PowerShell的语言,还有的Python/Perl的...
+0
非常感谢你解决了我的问题 –
+0
很高兴能帮到你;如果您喜欢它,请不要忘记注册并接受它:-) –
答
您可以使用vbscript
(未测试)
Set objFS=CreateObject("Scripting.FileSystemObject")
strFile = "c:\test\file"
Set objFile = objFS.OpenTextFile(strFile)
Do Until objFile.AtEndOfLine
strLine= objFile.ReadLine
s = Split(strLine," ") 'save each word into array
' display
For i=0 To Ubound(s)
If InStr(s(i),"%") > 0 Then
WScript.Echo s(i)
End If
Next
Loop
有关如何使用VBScript的更多信息,download the manual并通过它
为什么不先试一下,然后在这里发布代码,如果你不能得到它的工作?提示:使用[find command](http://www.robvanderwoude.com/find.php) –
@Fredrik,find命令可以找到%符号,就这些了。 IT无法获得价值... – ghostdog74
我对批处理脚本非常陌生。我尝试使用正则表达式的findstr/R命令查找百分比值,但没有成功。 如果它是静态值,我可以使用find命令,但使用partcover报告生成值是动态的。请让我知道任何正则表达式。 –