Post by Rick_CIf I have a directory with a few text files how can I create a menu that
lists those files and I can open them from that menu, then return to that
menu when i've finished with a file?
In Win2k/XP/Vista this is trivial, type
for /?
start /?
set /?
for more information.
In pure DOS or Win9x this is more complicated. Here one way to do it:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
if [%1]==[1] goto :sub1
if [%1]==[2] goto :sub2
set n=a>_2.bat
echo %0 2 >>_2.bat
echo :loop>_1.bat
echo choice /n /cabcdefghijklmnopqrstuvwxyz0 [a-z, 0 for exit]:>>_1.bat
for %%i in (*.txt) do call %0 1 %%i
echo.
echo if not errorlevel 27 goto loop>>_1.bat
call _1.bat
if exist _1.bat del _1.bat
if exist _2.bat del _2.bat
goto eof
:sub1
set m=%2
_2.bat
:sub2
echo.>_2.bat
if [%n%]==[a] echo set n=b>>_2.bat
if [%n%]==[a] echo if errorlevel 1 if not errorlevel 2 edit %m% >>_1.bat
if [%n%]==[b] echo set n=c>>_2.bat
if [%n%]==[b] echo if errorlevel 2 if not errorlevel 3 edit %m% >>_1.bat
if [%n%]==[c] echo set n=d>>_2.bat
if [%n%]==[c] echo if errorlevel 3 if not errorlevel 4 edit %m% >>_1.bat
if [%n%]==[d] echo set n=e>>_2.bat
if [%n%]==[d] echo if errorlevel 4 if not errorlevel 5 edit %m% >>_1.bat
if [%n%]==[e] echo set n=e>>_2.bat
if [%n%]==[e] echo if errorlevel 5 if not errorlevel 6 edit %m% >>_1.bat
if [%n%]==[f] echo set n=e>>_2.bat
if [%n%]==[f] echo if errorlevel 6 if not errorlevel 7 edit %m% >>_1.bat
if [%n%]==[g] echo set n=e>>_2.bat
if [%n%]==[g] echo if errorlevel 7 if not errorlevel 8 edit %m% >>_1.bat
if [%n%]==[h] echo set n=e>>_2.bat
if [%n%]==[h] echo if errorlevel 8 if not errorlevel 9 edit %m% >>_1.bat
if [%n%]==[i] echo set n=e>>_2.bat
if [%n%]==[i] echo if errorlevel 9 if not errorlevel 10 edit %m% >>_1.bat
if [%n%]==[j] echo set n=e>>_2.bat
if [%n%]==[j] echo if errorlevel 10 if not errorlevel 11 edit %m% >>_1.bat
if [%n%]==[k] echo set n=e>>_2.bat
if [%n%]==[k] echo if errorlevel 11 if not errorlevel 12 edit %m% >>_1.bat
if [%n%]==[l] echo set n=e>>_2.bat
if [%n%]==[l] echo if errorlevel 12 if not errorlevel 13 edit %m% >>_1.bat
if [%n%]==[m] echo set n=e>>_2.bat
if [%n%]==[m] echo if errorlevel 13 if not errorlevel 14 edit %m% >>_1.bat
if [%n%]==[n] echo set n=e>>_2.bat
if [%n%]==[n] echo if errorlevel 14 if not errorlevel 15 edit %m% >>_1.bat
if [%n%]==[o] echo set n=e>>_2.bat
if [%n%]==[o] echo if errorlevel 15 if not errorlevel 16 edit %m% >>_1.bat
if [%n%]==[p] echo set n=e>>_2.bat
if [%n%]==[p] echo if errorlevel 16 if not errorlevel 17 edit %m% >>_1.bat
if [%n%]==[q] echo set n=e>>_2.bat
if [%n%]==[q] echo if errorlevel 17 if not errorlevel 18 edit %m% >>_1.bat
if [%n%]==[r] echo set n=e>>_2.bat
if [%n%]==[r] echo if errorlevel 18 if not errorlevel 19 edit %m% >>_1.bat
if [%n%]==[s] echo set n=e>>_2.bat
if [%n%]==[s] echo if errorlevel 19 if not errorlevel 20 edit %m% >>_1.bat
if [%n%]==[t] echo set n=e>>_2.bat
if [%n%]==[t] echo if errorlevel 20 if not errorlevel 21 edit %m% >>_1.bat
if [%n%]==[u] echo set n=e>>_2.bat
if [%n%]==[u] echo if errorlevel 21 if not errorlevel 22 edit %m% >>_1.bat
if [%n%]==[v] echo set n=e>>_2.bat
if [%n%]==[v] echo if errorlevel 22 if not errorlevel 23 edit %m% >>_1.bat
if [%n%]==[w] echo set n=e>>_2.bat
if [%n%]==[w] echo if errorlevel 23 if not errorlevel 24 edit %m% >>_1.bat
if [%n%]==[x] echo set n=e>>_2.bat
if [%n%]==[x] echo if errorlevel 24 if not errorlevel 25 edit %m% >>_1.bat
if [%n%]==[y] echo set n=e>>_2.bat
if [%n%]==[y] echo if errorlevel 25 if not errorlevel 26 edit %m% >>_1.bat
if [%n%]==[z] echo set n=e>>_2.bat
if [%n%]==[z] echo if errorlevel 26 if not errorlevel 27 edit %m% >>_1.bat
echo %0 2 >>_2.bat
echo [%n%] %m%
:eof