0

I am having a problem. I need my code to list all the text files in a big directory and pause at each full screen. I set it up so that users will be able to input the number that is listed beside every txt file in the list but the /p parameter refuses to pause the list...

DIR SAVES\*.txt /B /P |FIND /V /N "//"
ECHO.
ECHO (Press "Q" to EXIT to the main menu)
ECHO.
CHOICE /C DLVQ /N /M "Would you like to DELETE, LOAD, or VIEW a file [D/L/V]?"
     IF ERRORLEVEL 4 GOTO MENU
     IF ERRORLEVEL 3 GOTO VIEW
     IF ERRORLEVEL 2 GOTO LOAD1
     IF ERRORLEVEL 1 GOTO DELETE

:DELETE
ECHO.
SET /P C=Choose the file number [#] to DELETE (and press ENTER):
FOR /F "usebackq tokens=1,2* delims=[]" %%d IN (`DIR SAVES\*.txt /B ^|FIND /V /N "//"`) DO (
    IF /I !C! EQU q (GOTO MENU)
    IF !C! EQU %%d (
        ECHO.
        CHOICE /N /M "Are you sure you want to DELETE %%e [Y/N]?"
            IF ERRORLEVEL 2 GOTO LOAD       
        DEL /Q "SAVES\%%e"
        DEL /Q "SAVES\"%%~ne"_stats"
        IF EXIST "SAVES\%%e" (
            IF EXIST "SAVES\"%%~ne"_stats" (
                GOTO DELETE1

The folder could potentially have hundreds of txt save files and i need the ability to run this script in its own cmd window and pause as the screen fills up with info. Running my whole utility as a .bat means there is NO scrollbar available for users to view all the files. How can I make the /P pause parameter work?

Gorgrak
  • 15
  • 6

1 Answers1

3

You're piping the output of dir to find. find itself doesn't do pagination and simply outputs anything it matches in the input. dir itself can't do the pagination in this case, because find would be unable to do the input to advance to the next page, so you've effectively disabled pagination.

Try

dir | find | more
Marc B
  • 356,200
  • 43
  • 426
  • 500