I have the following batch file which searches for a file then copies it into the root folder:
REM Set variable name filename to prompt result.
set /p fileName=Enter filename?
if "%fileName%"=="" goto :EOF
REM Set expression cnt
set /a cnt=0
REM Search for file in done directory if found, copy
for /f "delims=" %%a in ('dir c:\files\done c:\files\failed /b 2^>NUL ^| findstr /l /c:"%fileName%"') do set /a cnt+=1&set copyName=%%a&echo
REM If no matching files found, exit.
if /i %cnt% EQU 0 echo No files found matching "%fileName%".
REM If more than one matching file is found, list files and ask user to type in name again.
if /i %cnt% GTR 1 echo More than one file matches "%fileName%". Please be more specific or press CTRL+C to terminate.&goto START
copy "%copyName%" ..
What I want to do, is repeat this batch until a key is pressed, for example,
do until (KEY is pressed)
<place batch code here>
Can this be done in MS-DOS? Is there another alternative?