I want to make a batch script have a typewriter style/effect while deleting files and displaying echoes and stuff. I would like it to look like this for example:
:Write1
echo Deleting Prefetches...
del /s /q "C:\Windows\Prefetch\JAVAW*.pf"
echo Prefetches Deleted.
pause && goto :Write2
(Then Write2 would delete stuff, display messages and go to Write3 and so on.
This would not be the exact code I implement but very similar. I have this code (long) and I was wondering if anyone could error patch it or just find out what's wrong with it, because it repeats itself and doesn't go after the pause. Here's what I have so far: (Note, the files it deletes aren't system files and are shortcuts and registry keys that do nothing. clean to test.)
@echo off
:: %len_% holds the value of the length of the string input
setlocal enabledelayedexpansion
call :Write "Deleting Prefetches..."
del /s /q "C:\Windows\Prefetch\VAPE*.pf"
del /s /q "C:\Windows\Prefetch\JAVAW*.pf"
echo Prefetches Deleted!
pause && goto :Write2
setlocal enabledelayedexpansion
call :Write2 "Deleting Shellbags..."
reg delete HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell /va /f
reg delete HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Bags /va /f
reg delete HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\BagMRU /va /f
reg delete HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RunMRU /VA /F
reg delete HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\TypedPaths /VA /F
reg delete HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSavePidlMRU /va /f
echo Shellbags Deleted!
pause && goto :Write3
setlocal enabledelayedexpansion
call :Write3 "Deleting Temp Files..."
for /d %%i in ("%TEMP%\Rar$EXa0.???") do rd "%TEMP%\%%i"
for /d %%i in ("%TEMP%\Rar$DIa0.???") do rd "%TEMP%\%%i"
rd /s /q "C:\Users\%USERNAME%\AppData\Local\Temp\Rar$EXa0.*.*"
del /s /q "C:\Users\%USERNAME%\AppData\Local\Temp\Rar$EXa0.*.*"
attrib -H "C:\Users\%USERNAME%\AppData\Local\Temp\etilqs_*.*"
del /s /q "C:\Users\%USERNAME%\AppData\Local\Temp\etilqs_*.*"
echo Temp Files Deleted!
pause && goto :Write4
setlocal enabledelayedexpansion
call :Write4 "Deleting Recent Items..."
del /s /q "?C:\Users\%USERNAME%\Recent\SDHC (E) (2).lnk"
del /s /q "?C:\Users\%USERNAME%\Recent\SDHC (E).lnk"
del /s /q "C:\Users\%USERNAME%\Recent\*.ahk.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\1.7.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\1.8.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\Vape Launcher.exe.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\Vape.jar.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\.vs.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\Common.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\Jar Injector.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\Vape Launcher.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\Vape Launcher.sln.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\v14.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\.suo.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\Memory.c.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\Memory.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\include.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\jdk.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\win32.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\classfile_constants.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\jawt.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\jdwpTransport.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\jni.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\jvmti.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\jvmticmlr.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\bridge.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\jawt_md.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\jni_md.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\AccessBridgeCallbacks.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\AccessBridgeCalls.c.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\AccessBridgeCalls.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\AccessBridgePackages.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\DllMain.c.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\Jar Injector.vcxproj.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\Jar Injector.vcxproj.filters.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\Jar Injector.vcxproj.user.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\ReflectiveDLLInjection.h"
del /s /q "C:\Users\%USERNAME%\Recent\ReflectiveLoader.c.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\ReflectiveLoader.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\GetProcAddressR.c.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\GetProcAddressR.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\LoadLibraryR.c.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\LoadLibraryR.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\ReflectiveDLLInjection.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\resource.h.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\Vape Launcher.rc.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\Vape Launcher.vcxproj.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\Vape Launcher.vcxproj.filters.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\Vape Launcher.vcxproj.user.lnk"
del /s /q "C:\Users\%USERNAME%\Recent\WinMain.c.lnk"
echo Recent Items Deleted!
pause && goto :Write5
setlocal enabledelayedexpansion
call :Write5 "Deleting Recycled Items..."
del /s /q "C:\$RECYCLE.BIN\*.lnk"
del /s /q "C:\$RECYCLE.BIN\*.pf"
rd /s /q "C:\$RECYCLE.BIN\Rar$EXa0.*.*"
del /s /q "C:\$RECYCLE.BIN\Rar$EXa0.*.*"
rd /s /q "C:\$RECYCLE.BIN\Rar$DIa0.*.*"
del /s /q "C:\$RECYCLE.BIN\Rar$DIa0.*.*"
del /s /q "C:\$RECYCLE.BIN\etilqs_*.*"
echo Recycled Items Deleted!
pause && goto :eof
:Write
set string=%1
call :GetLength %string%
set string=%string:"=%
set /a length=%len_%
for /l %%A in (1,1,%length%) do (
cls
echo !string:~0,%%A!
ping localhost -n 1 -w 500 -l 5000 > nul
)
:Write2
set string=%1
call :GetLength %string%
set string=%string:"=%
set /a length=%len_%
for /l %%A in (1,1,%length%) do (
cls
echo !string:~0,%%A!
ping localhost -n 1 -w 500 -l 5000 > nul
)
:Write3
set string=%1
call :GetLength %string%
set string=%string:"=%
set /a length=%len_%
for /l %%A in (1,1,%length%) do (
cls
echo !string:~0,%%A!
ping localhost -n 1 -w 500 -l 5000 > nul
)
:Write4
set string=%1
call :GetLength %string%
set string=%string:"=%
set /a length=%len_%
for /l %%A in (1,1,%length%) do (
cls
echo !string:~0,%%A!
ping localhost -n 1 -w 500 -l 5000 > nul
)
goto :eof
:GetLength
set str=%1
set /a len=1
:loop
set /a len_=%len% - 1
if "!str:~0,%len%!"=="!str:~0,%len_%!" goto done
set /a len+=1
goto loop
:done
set /a len_-=2
goto :eof