Add "Delete on Reboot" to Right Click Menu

General software, Operating Systems, and Programming discussion.
Everything from software questions, OSes, simple HTML to scripting languages, Perl, PHP, Python, MySQL, VB, C++ etc.
Post Reply
User avatar
Norm
SG VIP
Posts: 14195
Joined: Tue Mar 27, 2001 12:00 pm

Add "Delete on Reboot" to Right Click Menu

Post by Norm »

Delete those pesky files, and folders that don't want to go.

Open notepad, and copy/paste the text below. Save the file as whatever.reg
Double clicking the whatever.reg file will add it to the registry, and give you the option to: "Delete on Reboot" when you right click a file or folder.

Code: Select all

Windows Registry Editor Version 5.00

[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\""

Should work with XP Home, Pro, and Win2K
Backup your registry first!!!

I found this online somewhere, but can't remember where.
I wanted to give credit to the author, but can't find the original thread it was in.
[edit] Found the thread it was in Here

I've tried it here on XP Pro, and it works well.
User avatar
Prey521
Posts: 34932
Joined: Sat Feb 05, 2000 12:00 pm
Location: Humble, Tx

Post by Prey521 »

n/m :)


Gonna try it now for my home PC, I have a similar app that does this now, but doesn't work very well, thanks for the linkage.
owned by pac0z atm

User avatar
Sid
SG Elite
Posts: 5174
Joined: Sun Sep 17, 2000 12:00 pm
Location: Hell's Kitchen

Post by Sid »

Great find there Norm. Thanks for the code
User avatar
Norm
SG VIP
Posts: 14195
Joined: Tue Mar 27, 2001 12:00 pm

Post by Norm »

This will take care of most pesky files or folders, but not all, in all cases.

Since the file gets deleted 'after' a user logs on, it IS possible the file will already be "in use" by the system, or another process, and access is denied.

Also, some pesky files are recreated by another process (usually, but not always, viral) and will reappear even if deleted.

Good for most though.....
User avatar
morbidpete
Posts: 7283
Joined: Sat Mar 30, 2002 12:00 pm
Location: W. Warwick RI

Post by morbidpete »

thats a whole bunch norm..had 2 folders on ym hdd that were empty and wouldnt deleat no matter what....this took care of them..awsome!
User avatar
YeOldeStonecat
SG VIP
Posts: 51171
Joined: Mon Jan 15, 2001 12:00 pm
Location: Somewhere along the shoreline in New England

Post by YeOldeStonecat »

Heehee...oh the pranks that can be pulled with this one. :D
MORNING WOOD Lumber Company
Guinness for Strength!!!
User avatar
ColdFusion
Posts: 3542
Joined: Mon Oct 30, 2000 12:00 am
Location: Vancouver, BC

Post by ColdFusion »

Sweet! Great find there norm!
User avatar
The Dude
Senior Member
Posts: 3126
Joined: Thu Jan 24, 2002 6:24 pm
Location: CYQY

Post by The Dude »

Great find, Norm! :thumb:
User avatar
Prey521
Posts: 34932
Joined: Sat Feb 05, 2000 12:00 pm
Location: Humble, Tx

Post by Prey521 »

How do you UNDO an accidental Delete on Reboot?
owned by pac0z atm

User avatar
ColdFusion
Posts: 3542
Joined: Mon Oct 30, 2000 12:00 am
Location: Vancouver, BC

Post by ColdFusion »

In the registry browse to:
HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\Currentversion\\RunOnce

and delete the entry that has something along the lines of Del <file> OnNextReboot\

I dont think you are ... but if you are asking how to undelete after the file has already been deleted then im not sure. Probibaly need some sort of file recovery software.
User avatar
The Dude
Senior Member
Posts: 3126
Joined: Thu Jan 24, 2002 6:24 pm
Location: CYQY

Post by The Dude »

Check the recycle bin to see if it ended up there.
User avatar
ghost
SG VIP
Posts: 11599
Joined: Wed Oct 20, 1999 12:00 am
Location: Virginia

Post by ghost »

Thanks Norm, a case just came up today where I may need such a tool. :thumb:
User avatar
AMPLIFRIER
Posts: 1641
Joined: Fri Jun 22, 2001 12:20 am
Location: 127.0.0.1

Post by AMPLIFRIER »

NO DOUBT!!!!!

that is such an awesome menu item to have!!!!!

sweet

AMP
Gigabyte ga-7n400 pro nForce2 mobo, Athlon XP3200, thermalright slk900, 1 gig corsair pc3200 cas2, radeon 9800pro, SB Audigy 2 ZS
case= yeong yang YY-B0221 server cube,550 watt Antec true power,1 wd raptor 74 gig,1 34gig raptor (page) 2 wd 120gig se's raid 1, 1 120gig se. WIN xp Pro, Dual display samsung syncmaster 1100df 21in(Primary) Samsung syncmaster 955df 19in (secondary)".
User avatar
striker8000
Posts: 881
Joined: Tue Mar 02, 2004 5:28 pm
Location: lost in time

Post by striker8000 »

Prey521 wrote:How do you UNDO an accidental Delete on Reboot?
if it isn't in the recycle bin...file recovery software

it should be a simple name change (to mark as deleted until the space is needed), and a simple search to relocate the file....google isn't showing anything interesting yet
still folding away, haven't been on as much lately
User avatar
Prey521
Posts: 34932
Joined: Sat Feb 05, 2000 12:00 pm
Location: Humble, Tx

Post by Prey521 »

striker8000 wrote:if it isn't in the recycle bin...file recovery software
Thx, ColdFusion answered it for me.
owned by pac0z atm

User avatar
Jamie_R
Posts: 10451
Joined: Thu Feb 10, 2000 12:00 pm
Location: NC

Post by Jamie_R »

Thanks Norm :thumb:
.

The only thing necessary for the triumph of evil is for good men to do nothing.
mfcdsmfcds

Post by mfcdsmfcds »

I wanted to remove this thing. I added it to my pc, but I think it isn't working. I'm on vista home premium and it doesn't work. please help :D
User avatar
Watch5869
Regular Member
Posts: 297
Joined: Wed Jul 18, 2001 11:10 pm

Post by Watch5869 »

Norm wrote:Delete those pesky files, and folders that don't want to go.

Open notepad, and copy/paste the text below. Save the file as whatever.reg
Double clicking the whatever.reg file will add it to the registry, and give you the option to: "Delete on Reboot" when you right click a file or folder.

Code: Select all

Windows Registry Editor Version 5.00

[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\""

Should work with XP Home, Pro, and Win2K
Backup your registry first!!!

I found this online somewhere, but can't remember where.
I wanted to give credit to the author, but can't find the original thread it was in.
[edit] Found the thread it was in Here

I've tried it here on XP Pro, and it works well.

I tried this but get an error message: "Cannot Import [Path] [filename] The specified file is not a registry script. You can only import binary registry files from within the registry editor"

did I do something wrong?
CableDude
SG VIP
Posts: 26801
Joined: Sat Jun 02, 2001 12:00 pm

Post by CableDude »

Watch5869 wrote:I tried this but get an error message: "Cannot Import [Path] [filename] The specified file is not a registry script. You can only import binary registry files from within the registry editor"

did I do something wrong?
What OS?
User avatar
Watch5869
Regular Member
Posts: 297
Joined: Wed Jul 18, 2001 11:10 pm

Post by Watch5869 »

CableDude wrote:What OS?
Win XP Home
User avatar
ghettoside
SG Elite
Posts: 5134
Joined: Thu Mar 13, 2003 5:18 pm
Location: At Large in the US

Post by ghettoside »

Watch5869 wrote:I tried this but get an error message: "Cannot Import [Path] [filename] The specified file is not a registry script. You can only import binary registry files from within the registry editor"

did I do something wrong?
are you sure you saved it as a .reg file and not a .txt?

open the notepad file you created. from drop down menu, "save as", then select "all files" type, and then add ".reg" to the file name. close up the file, then you should have the original txt and a new reg file.

btw, you can also change file extensions by changing your folder options to show file extensions.

tools>folder options>view>hide extensions for known file types

uncheck that box and you can see & edit extensions.
Norm wrote:
There are idiots everywhere.

At work, in forums, in poetry classes, everywhere!
coolpc
New Member
Posts: 2
Joined: Sat Apr 06, 2013 8:51 pm

Post by coolpc »

how to undo this?
coolpc
New Member
Posts: 2
Joined: Sat Apr 06, 2013 8:51 pm

Post by coolpc »

help! I want to undo this
Post Reply