Defragmentiert jedes Laufwerk in einem Endlos-Loop.
Leider bekomme ich es einfach nicht hin, mit den Errorlevels von chkdsk ein vernünftiges Verhalten zu erreichen :(
Unbekannter Typ
@echo off
cd /d C:\
:loop
if exist c:\NUL call:defrag C
if exist d:\NUL call:defrag D
if exist e:\NUL call:defrag E
if exist f:\NUL call:defrag F
if exist g:\NUL call:defrag G
if exist h:\NUL call:defrag H
if exist i:\NUL call:defrag I
if exist j:\NUL call:defrag J
if exist k:\NUL call:defrag K
if exist l:\NUL call:defrag L
if exist m:\NUL call:defrag M
if exist n:\NUL call:defrag N
if exist o:\NUL call:defrag O
if exist p:\NUL call:defrag P
if exist q:\NUL call:defrag Q
if exist e:\NUL call:defrag R
if exist s:\NUL call:defrag S
if exist t:\NUL call:defrag T
if exist u:\NUL call:defrag U
if exist v:\NUL call:defrag V
if exist w:\NUL call:defrag W
if exist x:\NUL call:defrag X
if exist y:\NUL call:defrag Y
if exist z:\NUL call:defrag Z
echo.
echo pause...
ping localhost -n 10 >NUL
goto loop
:defrag
net use | find /i "%1:" >NUL
if not errorlevel 1 (
echo %1: ist ein Netzlaufwerk
echo.
goto:eof
)
echo chkdsk %1:
chkdsk %1:
if not errorlevel 0 (
echo %1: chkdsk Fehler!!!
pause
goto:eof
)
echo defrag %1: -f
defrag %1: -f
if not "%errorlevel%"=="0" pause
rem pause...
ping localhost -n 1 >NUL
goto:eof
permalink