Conidtional menu batch help...

Hewlett-packard / Sd2100
January 22, 2009 at 12:34:02
Specs: Windows XP, 1024
How do I set it so option 3 cant run unless 2 is already ran then the user can use option "3"? I would like a message in there to saying why they where return to the menu. Thanks for the help!


ECHOOFF
cls
:MENU
:loop
ECHO ..................................
ECHO PRESS 1 or 2 to select your task
ECHO ..................................
ECHO 1 - Delete temporary files!
ECHO 2 - Check hard drive for errors!
ECHO R - Restart to finish Scandisk!

SET Choice=
SET /P Choice= Type 1, 2, 3, 4, 5, 6 ,R, Q, I, then press ENTER:
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%
IF /I '%Choice%'=='1' GOTO ctemp
IF /I '%Choice%'=='2' GOTO chkdk
IF /I '%Choice%'=='3' GOTO restart
cls
ECHO "%Choice%" is not valid. Please try again.
color 0c
pause
cls
GOTO loop
:ctemp
del /f /q %windir%\Temp\*.*>> WRPlog.txt
del /f /s /q %systemdrive%\*.tmp >> WRPlog.txt
del /f /s /q %systemdrive%\*._mp >> WRPlog.txt
del /f /s /q %systemdrive%\*.log >> WRPlog.txt
del /f /s /q %systemdrive%\*.gid >> WRPlog.txt
del /f /s /q %systemdrive%\*.chk >> WRPlog.txt
del /f /s /q %systemdrive%\*.old >> WRPlog.txt
del /f /s /q %systemdrive%\recycled\*.* >> WRPlog.txt
del /f /s /q %windir%\*.bak >> WRPlog.txt
del /f /s /q %windir%\prefetch\*.* >> WRPlog.txt
del /f /q %userprofile%\cookies\*.* >> WRPlog.txt
del /f /q %userprofile%\recent\*.* >> WRPlog.txt
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*" >> WRPlog.txt
del /f /s /q "%userprofile%\Local Settings\Temp\*.*" >> WRPlog.txt
del /f /s /q "%userprofile%\recent\*.*" >> WRPlog.txt
cls
color 0a
ECHO Temporary file deleted!
ECHO Temporary files deleted! >>WRPlog.txt
pause
cls
GOTO MENU

:chkdk
echo y > confirm.txt
chkdsk /r < confirm.txt
del /f /s /q confirm.txt
cls
:loop1
color 0f
ECHO..................................................................
ECHO Your Computer needs to be restarted to Scan your hard drive!
ECHO .................................................................
SET Choice=
SET /P Choice= Type yes or No then press Enter:
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,3%
IF /I '%Choice%'=='yes' GOTO yes
IF /I '%Choice%'=='no' GOTO no
cls
ECHO "%Choice%" is not valid. Please try again.
color 0c
pause
cls
GOTO loop1
:yes
shutdown -r
:no
cls
GOTO MENU

:restart
cls
:loop3
color 0f
ECHO......................................................
ECHO Make sure you seleted Scan Disk option in (3)
ECHO......................................................
SET Choice=
SET /P Choice= Type yes or No then press Enter:
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,3%
IF /I '%Choice%'=='yes' GOTO yes
IF /I '%Choice%'=='no' GOTO no
cls
ECHO "%Choice%" is not valid. Please try again.
color 0c
pause
cls
GOTO loop1
:yes2
shutdown -r
:no2
cls
GOTO MENU



See More: Conidtional menu batch help...

Report •


#1
January 22, 2009 at 21:46:39
echo off & setlocal
set bCanRunNo3=
.
.
:loop
IF /I '%Choice%'=='3' if %bCanRunNo3%==true GOTO restart
. 
.
.
:chkdsk
echo y|chkdsk/r
set bCanRunNo3=true


Report •

#2
January 22, 2009 at 22:31:45
i changed the code but all it does now is close whats wrong?

Report •

#3
January 23, 2009 at 07:37:31
need help still Thank you all.

Report •

Related Solutions


Ask Question