We help IT Professionals succeed at work.
Get Started

Related to: Suppress RD in batch - menu options?

549 Views
Last Modified: 2013-11-10
Reference back to :
https://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/Q_26248662.html

As you can see when i add the accepted code into my Menu batch , it acts weird.

is not right?

also the attached is the BIG bat file i want to eventually finalize.
 IT-ToolwoRx-v3.1a.bat.txt
@ECHO OFF
@color 0A
:MENU
ECHO.
ECHO ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
ECHO º      Choose Your Tool       º
ECHO ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
ECHO.
ECHO 1 - Windows XP (Temp Cleaner)
ECHO 2 - Windows 7 (Temp Cleaner)
ECHO.
SET /P M=Select a number, then press ENTER: 
IF %M%==1 GOTO XP
IF %M%==2 GOTO 7

:XP
CLS
@COLOR 04
@ECHO OFF
setlocal enabledelayedexpansion
@ECHO.
@ECHO.
set i=0
@Echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
@ECHO º       Now Cleaning Your System      º
@Echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
@ECHO.
(Set /P j= ) < NUL

for /F "tokens=1 delims=[]" %%N in ('find /N ":StartOfCodeXP" ^<"%~f0"') do set start=%%N
for /F %%N in ('find /C /V "" ^<"%~f0"') do set /A lines=%%N-start
set line=0
for /F "skip=%start% usebackq tokens=* delims=" %%L in ("%~f0") do (
  call %%L 2>nul >nul
  set /P j=Û< NUL
  set /A line += 1
  set /A pct= line * 100 / lines
  title !pct!^% done
)  

PAUSE>NUL
GOTO Done

:StartofCodeXP
cd %SYSTEMDrive%\
RD /s /q "%WINDIR%\Prefetch"
RD /s /q "%TEMP%"
RD /s /q "%USERPROFILE%\Local Settings\Temp"
RD /s /q "%USERPROFILE%\Local Settings\Temporary Internet Files"
RD /s /q "%USERPROFILE%\Cookies"
RD /s /q "%SystemRoot%\Downloaded Program Files"
RD /s /q "%SystemRoot%\Temp"
RD /s /q "%SystemRoot%\tmp"
RD /s /q "C:\$Recycle.bin"
REM  ---Super File Cleaner
del /f /s /q %SystemDrive%\*.log
del /f /s /q %SystemDrive%\~*.*
del /f /s /q %SystemDrive%\*.tmp
del /f /s /q %SystemDrive%\*.bak
del /f /s /q %SystemDrive%\*.old
REM  ---END of Super File Cleaner

:7
CLS
@COLOR 04
@ECHO OFF
setlocal enabledelayedexpansion
@ECHO.
@ECHO.
set i=0
@Echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
@ECHO º       Now Cleaning Your System      º
@Echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
@ECHO.
(Set /P j= ) < NUL

for /F "tokens=1 delims=[]" %%N in ('find /N ":StartOfCode7" ^<"%~f0"') do set start=%%N
for /F %%N in ('find /C /V "" ^<"%~f0"') do set /A lines=%%N-start
set line=0
for /F "skip=%start% usebackq tokens=* delims=" %%L in ("%~f0") do (
  call %%L 2>nul >nul
  set /P j=Û< NUL
  set /A line += 1
  set /A pct= line * 100 / lines
  title !pct!^% done
)  

PAUSE>NUL

GOTO Done

:StartOfCode7
cd /D %SYSTEMDrive%\
RD /s /q "%WINDIR%\Prefetch"
RD /s /q "%TEMP%"
RD /s /q "%USERPROFILE%\Local Settings\Temp"
RD /s /q "%USERPROFILE%\Local Settings\Temporary Internet Files"
RD /s /q "%USERPROFILE%\Cookies"
RD /s /q "%SystemRoot%\Downloaded Program Files"
RD /s /q "%SystemRoot%\Temp"
RD /s /q "%SystemRoot%\tmp"
RD /s /q "C:\$Recycle.bin"
REM  ---Super File Cleaner
del /f /s /q %SystemDrive%\*.log
del /f /s /q %SystemDrive%\~*.* 
del /f /s /q %SystemDrive%\*.tmp
del /f /s /q %SystemDrive%\*.bak
del /f /s /q %SystemDrive%\*.old
REM  ---END of Super File Cleaner

:Done
CLS
@COLOR 0A
@Echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
@Echo º      Your System is now Clean       º
@Echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
@PAUSE
CLS
GOTO MENU

Open in new window

Comment
Watch Question
"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
Unlock 2 Answers and 12 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE