@ECHO OFF :: DelDeadProfiles, Version 1.00 for Windows NT :: Removes unused leftovers of corrupted profiles for the current user ID. :: If the current user profile is C:\WINNT\Profiles\userid.000 then both :: C:\WINNT\Profiles\userid and C:\WINNT\Profiles\userid.002 will be :: removed. :: Written by Rob van der Woude :: http://www.robvanderwoude.com CALL :CheckIfCorrupt %userprofile% GOTO:EOF :CheckIfCorrupt FOR /D %%A IN (%~dpn1.*) DO CALL :DelDeadProfiles %%A %userprofile% GOTO:EOF :DelDeadProfiles if not [%~f1]==[%~f2] echo Deleting corrupted profile %~nx1 . . . if not [%~f1]==[%~f2] rd /s /q %1 goto:EOF