Skip to content

Main page

Artyomka628 edited this page Feb 13, 2026 · 2 revisions

DelAfterReboot

What the script does

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.

How it works

  1. The script checks for administrative privileges and, if needed, restarts itself with UAC elevation.
  2. It gathers a full list of files and folders inside the specified directory (traversing bottom-up).
  3. It writes the paths to HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations.
  4. On reboot, Windows removes the listed items.

Installation

Via Winget

winget install delafterreboot

Via msi installer

x64 x86 arm64

Manual build

All instructions for manual buld in README

Usage

Delete a folder after reboot

delafterreboot.exe "C:\path\to\folder"

Delete a folder after reboot (without delay)

Without it, for easier output reading, there is 1 second delay

delafterreboot.exe "C:\path\to\folder" --nodelay

Cancel scheduled deletion

delafterreboot.exe --cancel

Debug mode (MessageBox with log)

delafterreboot.exe "C:\path\to\folder" --debug

Explorer context menu (optional)

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

Uninstall

Remove the context menu entry

reg delete "HKEY_CLASSES_ROOT\Directory\shell\DelAfterReboot" /f

Clear PendingFileRenameOperations

delafterreboot.exe --cancel

Examples

  • Schedule deletion:
delafterreboot.exe "D:\Temp\OldBuild"
  • Cancel:
delafterreboot.exe --cancel