Cloc 是一款命令行代码统计工具,一条命令就能数清项目里各语言的代码行数、空行和注释行,支持目录、压缩包甚至 git 提交等多种来源。输出表格清晰直观,Windows 下无需额外依赖即可运行,适合开发者、技术负责人快速评估项目体量与代码构成。
核心亮点:
- 按语言分别统计代码、注释与空行
- 支持目录、压缩包和 git 提交统计
- Windows 可执行文件开箱即用
- 结果以表格呈现,项目构成一目了然
当前版本 v2.12(2026-11-13 发布),开源协议 GPL-2.0,GitHub 23,677 star。

核心信息
| 软件名称 | Cloc(AlDanial/cloc) |
| 当前版本 | v2.12 |
| 更新日期 | 2026-11-13 |
| 开源协议 | GPL-2.0 |
| 软件分类 | Windows 效率工具 |
| 关键词 | cloc、count-lines、programming-language |
本次更新内容
- 新版本修复了压缩包处理中的安全漏洞,此前版本可能被恶意文件利用,建议尽快更新以保护系统安全。
- 新增对多种编程语言和文件类型的识别支持,并可直接统计压缩包内容,扩展了统计范围。
- 新增显示总计列的功能,语言排除选项不再区分大小写,与包含选项保持一致,使用更顺手。
- 改进了注释识别和文件扩展名识别,减少统计误差。
- 修复了处理大文件时内存占用过高、特定语言超时及长路径下文件重复打开等问题,运行更稳定。
查看官方英文更新日志(原文)
> This is a security release to address vulnerabilities in the handling of archive files (zip, tar, rpm, whl, gem, etc). A maliciously crafted archive file counted with cloc versions before this release can allow a remote code execution (RCE) attack. > All users are encouraged to update to this (or newer, when available) version. ## New Languages and File Types: - AL (Business Central) - CUE - KDL - RON - Salam - Sema - Windows INF - Wren ## Updates: - Add ability to count contents of .gem files. - New switch `--total` to show total column counts - Make `--exclude-lang` case insensitive to make it consistent with `--include-lang` - Recognize comment markers in single quoted QML strings - Add .scp as an extension for SQL stored procedures - Add `.inc` as an extension for Assembly Bug fixes: - Secure handling of system calls to expand archive files. - Prevent regex timeouts in Swift. - Lower memory requirements when handling large XML/HTML and binary files. - Fix double-open on Windows when handling long paths. - Ensure an archive file is not a directory before attempting to extract it.
下载地址
以下为官方原包,本站不二次打包,点击直接下载:
cloc-2.12.exe(官方安装程序 | 9.5 MB)
✅ 上方 SHA256 与官方发布值一致,可自行核对。
快速上手
- 双击运行下载好的 cloc 可执行文件,确认能正常启动并显示用法信息。
- 打开命令提示符(cmd.exe),进入存放待统计代码的文件夹所在目录。
- 在命令行输入可执行文件名并跟上一个文件路径,统计该文件的空行、注释行与代码行。
- 把参数换成目录路径,即可递归统计整个目录下各语言的代码行数并查看汇总结果。
提示:路径含空格时用英文引号括起来,统计结果更准确。
讨论(0 条)