windows - How do I make a batchscript that displays only the last line of a textfile? -


this might have been answered before couldn't find on topic. im trying make chat messenger in batch , need display last line of textfile. here's tried (not elegant):

@echo off /f %%x in (address.txt) set address=%%x :a if not exist "%address%" goto goto b :b set skipcount=1 :c /f "skip=%skipcount%" %%m in (%address%) echo %%m set m1=%%m :d /f %%m in (%address%) echo %%m > nul if not %%m==%m1% set skipcount=%skipcount%+1 goto d  goto c 

this might work think full of mistakes example syntax errors^^ trying few hints wrong:)

here's pure batch utility (requires no external tools) can shows range of numbered lines

to show last line use this:

call tailhead.bat -file=address.txt -end=1 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -