批处理文件计数器在“y”答案上递增

时间:2015-10-29 17:43:26

标签: batch-file

我正在尝试让以下batch文件仅在“y”时增加计数器%var1并且无法使语法正确。如果是%var1%=1,那么我正在尝试显示函数:end。我究竟做错了什么?谢谢 :)。

问题

set /P c=Has the check been done [y/n]
set /P c=Do you want to perform the check [y/n]

整批

@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
 )
 :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
 )
  :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
 )
 :: 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%"

0 个答案:

没有答案