I am trying to have the below batch file do following two things:
-
only allow the values YES,yes,Y,y, or NO,no,N,n
-
increment the counter %var1 only if answer to question 2 is "y" and not able to get the syntax correct. If %var1%=1 then I am trying to display function
:end
. Thank you :).
Question 2
set /P c=Do you want to send the DOSE report[y/n]?
Batch file as is:
@ECHO OFF
:: ask user
:choice
set /P c=Has the check been done [y/n]
if /i %c%==y (
set /P c=Do you want to send the DOSE report[y/n]?
) else (
if /i %c%==n goto check
)
:file
if /i %c%==y (
"L:\NGS\HLA LAB\total quality management\QC & QA\DOSE reports\DOSE reporting form.xlsm"
) else (
if /i %c%==n goto goodbye
)
:check
set /P c=Do you want to perform the check [y/n]
if /i %c%==y (
set /P c=please complete the check and click enter
goto file
) else (
if /i %c%==n goto goodbye
)
:goodbye
echo "goodbye"
TIMEOUT 2 /nobreak
exit
:: count loop
set var1=0
:loop
set /a var1=%var1%+1
if %var1% EQU 1 (
goto end
) else (
goto loop
)
:goodbye
echo "goodbye"
TIMEOUT 2 /nobreak
exit
:end
echo "the DOSE report has already been sent by %USERNAME% on %DATE% at %TIME%"