PAUSE in batch files:

by Solitaire (Login Solitaire1)
S

It's been many years since the last time I wrote a batch file program. It does include the PAUSE command which you follow with a message. It stops and waits for the user to read the message and continues when the user presses any key. Your message may tell the user to press Control-Break to stop at this point if he doesn't want to continue.

Alternatively, you can get a choice from your user.

I just looked into an old archived folder on my hard drive from way back, and found a couple of batch files I wrote that you can examine for any ideas. Here are two of them: One is for running QB4.5 and the other is for running Turbo C. Hope this helps:

======================================================================================================================
@echo off
cls
c:
echo QB45 must be started in same directory where EXE files will be created.
echo Default directory is D:\LANG\QBDATA.
echo QuickBasic data directory is D:\LANG\QB45\DATA
echo Choose 'D' for default, 'Q' for Quick or 'L' for present location.
echo.
echo.
choice /c:dql
if errorlevel 3 goto location
if errorlevel 2 goto quick
if errorlevel 1 goto default

:default
D:
cd\
CD lang\qbdata
call d:\lang\qb45\qb
goto end

:quick
D:
cd\
CD lang\qb45\data
call d:\lang\qb45\qb
goto end

:location
call d:\lang\qb45\qb
goto end

:end
c:
cd\
cls

===================================================================================================================
@echo off
CLS
echo Turbo C 3 will not run in a DOS Window session, only in DOS mode.
echo Type N to exit now, Y to continue.
choice
if errorlevel 2 goto exit
echo.
echo The D:\TC\BIN path will now be placed temporarily
echo in your computer's memory.
echo.
SET OLDPATH=%PATH%
PATH=D:\TC\BIN;%PATH%
echo.
echo Where do you want to save your files?
echo.
echo Please type A for the A drive, D for the D drive, or L for other location.
echo If you choose D, data will be stored in the D:\TCDATA subdirectory.
echo.
choice /c:adl
if errorlevel 3 goto L
if errorlevel 2 goto D
if errorlevel 1 goto A
:A
CLS
echo.
echo Please place floppy disk in drive A.
echo.
pause
echo.
a:
cd\
call TC.EXE
goto end
:D
CLS
d:
cd d:\tcdata
call TC.EXE
goto end
:L
CLS
echo.
echo This will run Turbo C from your present location in any drive
echo or subdirectory. After Turbo C starts, you will have to specify
echo the drive or directory for saving and retrieving files.
pause
call TC.EXE
:end
cls
PATH=%OLDPATH%
SET OLDPATH=
cd
echo.
dir *.bak /b
dir *.exe /b
dir *.obj /b
echo.
echo Delete all .BAK, .EXE, and .OBJ files in this directory? (y or n)
CHOICE
IF ERRORLEVEL 2 GOTO exit
IF ERRORLEVEL 1 GOTO clean
:clean
del *.bak
del *.exe
del *.obj
:exit

Posted on Apr 29, 2012, 3:25 PM

Respond to this message   

Return to Index