Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO OFF
- COLOR 1B
- :home
- CLS
- set /P File2Read=Enter File Name With EXT:
- If Not Exist "%File2Read%" (Goto :Error)
- rem This will read a file into an array of variables and populate it
- setlocal EnableExtensions EnableDelayedExpansion
- for /f "delims=" %%a in ('Type "%File2Read%"') do (
- set /a count+=1
- set "Line[!count!]=%%a"
- )
- rem Display array elements
- For /L %%i in (1,1,%Count%) do (
- echo !Line[%%i]!
- )
- pause>nul
- goto home
- ::***************************************************
- :Error
- cls & Color 4C
- echo(
- echo The file "%File2Read%" dos not exist !
- Pause>nul
- exit /b
- ::***************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement