Skip to content

Instantly share code, notes, and snippets.

@rez-f
Created March 20, 2020 11:10
Show Gist options
  • Save rez-f/2241b32b729fa8aa93c9de985e03d7c8 to your computer and use it in GitHub Desktop.
Save rez-f/2241b32b729fa8aa93c9de985e03d7c8 to your computer and use it in GitHub Desktop.
Batch Script used to count the lines of any text files
cls
@echo off
:: Script untuk menghitung baris yang terdapat didalam file txt
:: Letakkan dalam 1 direktori yang sama dengan file yang hendak di hitung barisnya
title Penghitung Baris
color 0e
echo Sedang diproses, mohon tunggu......
::Ganti Menjadi nama file yang ingin di hitung baris / records nya
set file1=DEMO19Q1.txt
set file2=DRUG19Q1.txt
set file3=INDI19Q1.txt
set file4=OUTC19Q1.txt
set file5=REAC19Q1.txt
set file6=RPSR19Q1.txt
set file7=THER19Q1.txt
set /a cnt1=0
for /f %%a in ('type "%file1%"^|find "" /v /c') do set /a cnt1=%%a
set /a cnt2=0
for /f %%a in ('type "%file2%"^|find "" /v /c') do set /a cnt2=%%a
set /a cnt3=0
for /f %%a in ('type "%file3%"^|find "" /v /c') do set /a cnt3=%%a
set /a cnt4=0
for /f %%a in ('type "%file4%"^|find "" /v /c') do set /a cnt4=%%a
set /a cnt5=0
for /f %%a in ('type "%file5%"^|find "" /v /c') do set /a cnt5=%%a
set /a cnt6=0
for /f %%a in ('type "%file6%"^|find "" /v /c') do set /a cnt6=%%a
set /a cnt7=0
for /f %%a in ('type "%file7%"^|find "" /v /c') do set /a cnt7=%%a
cls
echo ---
echo = Terdapat %cnt1% records didalam file %file1%
echo = Terdapat %cnt2% records didalam file %file2%
echo = Terdapat %cnt3% records didalam file %file3%
echo = Terdapat %cnt4% records didalam file %file4%
echo = Terdapat %cnt5% records didalam file %file5%
echo = Terdapat %cnt6% records didalam file %file6%
echo = Terdapat %cnt7% records didalam file %file7%
echo ---
goto END
:END
color 0a
echo Selesai, tekan ENTER untuk keluar.
pause >nul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment