The Computer Oracle

Is there a registry key to tell windows to delete a file at next startup?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 5 Looping

--

Chapters
00:00 Is There A Registry Key To Tell Windows To Delete A File At Next Startup?
00:11 Accepted Answer Score 21
00:32 Answer 2 Score 1
00:50 Thank you

--

Full question
https://superuser.com/questions/58479/is...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows #windowsregistry

#avk47



ACCEPTED ANSWER

Score 21


Yes, the values are stored in the registry key

HKLM\System\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations

but you'd better use a tool for this, like MoveFile from SysInternals, or MoveLatr from BitSum (C source code provided for the latter), which do the registry editing for you.




ANSWER 2

Score 1


Add this to your registry and use the right click menu:

[HKEY_CLASSES_ROOT\*\shell\Delete on reboot\command]
@="CMD /E:OFF /C REG ADD HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\Currentversion\\RunOnce /v \"Del %1 OnNextReboot\" /d ^\"cmd.exe /c DEL /F /Q \\\"%1\\\"\" /f\""

[HKEY_CLASSES_ROOT\*\shell\Open]

[HKEY_CLASSES_ROOT\Folder\shell\Delete on reboot\command]
@="CMD /E:OFF /C REG ADD HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\Currentversion\\RunOnce /v \"Del %1 OnNextReboot\" /d ^\"cmd.exe /c RD /S /Q \\\"%1\\\"\" /f\""