Repository navigation
Main page
Artyomka628 edited this page Feb 13, 2026
·
2 revisions
DelAfterReboot marks files and folders to be deleted on the next Windows boot.
It writes the list of paths to the system registry value PendingFileRenameOperations, so deletion happens before most services start and before many locks are applied.
- The script checks for administrative privileges and, if needed, restarts itself with UAC elevation.
- It gathers a full list of files and folders inside the specified directory (traversing bottom-up).
- It writes the paths to
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations. - On reboot, Windows removes the listed items.
winget install delafterreboot
All instructions for manual buld in README
delafterreboot.exe "C:\path\to\folder"
Without it, for easier output reading, there is 1 second delay
delafterreboot.exe "C:\path\to\folder" --nodelay
delafterreboot.exe --cancel
delafterreboot.exe "C:\path\to\folder" --debug
You can add a command to the Explorer context menu using install.reg or manually:
reg add "HKCR\Directory\shell\DelAfterReboot" /ve /d "DelAfterReboot" /f
reg add "HKCR\Directory\shell\DelAfterReboot" /v "Icon" /d "%ProgramFiles%\DelAfterReboot\delafterreboot.exe,0" /f
reg add "HKCR\Directory\shell\DelAfterReboot\command" /ve /d "\"%ProgramFiles%\DelAfterReboot\delafterreboot.exe\" \"%1\"" /f
reg delete "HKEY_CLASSES_ROOT\Directory\shell\DelAfterReboot" /f
delafterreboot.exe --cancel
- Schedule deletion:
delafterreboot.exe "D:\Temp\OldBuild"
- Cancel:
delafterreboot.exe --cancel