您的位置:首页 > 运维架构 > Shell

用PowerShell来计算代码的大小和行数

2010-10-25 12:10 381 查看
这里是两段脚本来计算代码的大小和行数。
代码大小(MB):
(Get-ChildItem . -Recurse | Where-Object {(!$_.PSIsContainer) -And ($_.FullName -Match '\.(h|m|cpp|c|cs|y)$')} | Measure-Object -Property Length -Sum).Sum / 1MB
代码行数:
Get-ChildItem . -Recurse | Where-Object {(!$_.PSIsContainer) -And ($_.FullName –Match '\.(h|m|cpp|c|cs|y)$')} | ForEach-Object {$l = 0} {$l += (Get-Content $_.PSPath).Count} {$l}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: