Windows Page: verschil tussen versies

Uit Mike´s Wiki
Ga naar: navigatie, zoeken
(Nieuwe pagina aangemaakt met '= Lines cmd = {| border="0" cellspacing="0" cellpadding="1" style="border-width: 1px; border-spacing: 2px; font-size:11px;" |+ ''' Shows content of file with line...')
(geen verschil)

Versie van 31 dec 2015 om 15:11

Lines cmd

Shows content of file with line numbers in from of each line.
@echo off &setlocal
call :enumerate %1
pause
goto :eof

:enumerate FileName
for /f "tokens=* delims=1234567890" %%a in ('type "%~1"^|findstr /n "^"') do (
  set "line=%%a"
  set /a n+=1
  setlocal enabledelayedexpansion
  echo(!n!. !line:~1!
  endlocal
)
goto :eof