2013年7月1日 星期一

Batch讀檔案的行數

近期需要以Batch來取得檔案的總行數,找了一些範例測試可以work順便記錄下來。
@echo off
setlocal EnableDelayedExpansion
set lines=0
for /f "tokens=* delims=" %%i in (Test.txt) do (
set /A lines=!lines!+1
echo !lines!
)