Advertisement
Najeebsk

TEXT-READ.bat

Nov 15th, 2021
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.65 KB | None | 0 0
  1. @ECHO OFF
  2. COLOR 1B
  3. :home
  4. CLS
  5. set /P File2Read=Enter File Name With EXT:
  6. If Not Exist "%File2Read%" (Goto :Error)
  7. rem This will read a file into an array of variables and populate it
  8. setlocal EnableExtensions EnableDelayedExpansion
  9. for /f "delims=" %%a in ('Type "%File2Read%"') do (
  10.     set /a count+=1
  11.     set "Line[!count!]=%%a"
  12. )
  13. rem Display array elements
  14. For /L %%i in (1,1,%Count%) do (
  15.     echo !Line[%%i]!
  16. )
  17. pause>nul
  18. goto home
  19. ::***************************************************
  20. :Error
  21. cls & Color 4C
  22. echo(
  23. echo   The file "%File2Read%" dos not exist !
  24. Pause>nul
  25. exit /b
  26. ::***************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement