On Windows, there are several ways to quickly query the number of rows in a TXT file:
Use the find command
in the command prompt, use the command to quickly count the number of rows:find
bash复制代码find /c /v "" filename.txt
where is the file path. This command counts the number of non-blank lines in the file. If you want to count the total number of blank rows, check whether there are blank rows in the file.filename.txt
Use PowerShell commands
to count the number of rows in a file more quickly and accurately, and are suitable for large files:
powershell复制代码(Get-Content filename.txt).Count
Here is the file path. The file will be loaded line by line, and the number of rows can be obtained directly.filename.txtGet-Content
Use the wc command (for WSL or Unix-like environments)
If you have Windows Subsystem for Linux (WSL) installed, you can use the command directly:wc -l
bash复制代码wc -l filename.txt
The command displays the total number of rows in the file.
These methods can quickly count rows in a Windows environment, especially PowerShell and WSL commands for large files.wc