Jump to content

delete on next boot cmd help


Recommended Posts

hi

this is what i want to do

A right context menu option to delete a folder ad next reboot

this is what i have sofare:

[HKEY_CLASSES_ROOT\Directory\shell\delete]
@="Delete bij volgende Start"
[HKEY_CLASSES_ROOT\Directory\shell\delete\command]
@="dell.bat \"1%\""

the bat file:

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /V Cleanup /D "cmd.exe /C RD *.* /S /Q"

in the bat file, if you use it this way i know i must specify a folder to delete it

the question:

is there a command to use it on all folders, not just 1

question 2:

the same option to delete a file

thanks for reading this

:)

Link to comment
Share on other sites


soulin, more details please. :P

sixpack, what I can tell is that %CD% refers to current directory, and %%1 refers to current file. Hoping that hint helps ;)

You can try making your .BAT based on that info. And what do you mean by "all folders" ? Do you mean to say all folders within that folder? If so, use recursive folder removal ("rd /?" for help).

Link to comment
Share on other sites

@prathapml

with all folders i mean

delete a folder on the desktop

and delete a folder in lets say windows

so delete the folder with every thing in it

do you have a example on how to use the %CD% and %%1

have tryed every command i know and it still doesend work

Link to comment
Share on other sites

.reg

[HKEY_CLASSES_ROOT\Folder\Shell\Delete on Reboot\Command]
@="Delfolder.cmd \"%1\""

.cmd

set Dir2Del=%1
REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Currentversion\RunOnce /v DelOnNextReboot /d "cmd.exe /c RD /S /Q %Dir2Del%"

havent tested it but i think it should work

Link to comment
Share on other sites

suppose this will work, then you can only delete 1 folder

the code must be for multiepul folders

and must work to on files

my guess is it cant be done

or there must be a dll someware that can do all this

but give up, NEVER

Link to comment
Share on other sites

Sorry for late response: about PFR, try to download tools like alter.exe or similar and look to registry changes they made...

- U can add files to copy during boot sequention

- U can add files to delete during boot sequention

- U can delete all pending operation (but I dont recommend this)

PFR is also used for installing hotfixes (e.g. only newest version of files will be copied).

Link to comment
Share on other sites

This one works:

DeleteFolderonReboot.reg

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\Delete on reboot\command]
@="delfolder.cmd \"%1\""

Delfolder.cmd

@echo off
setlocal
set pathwithquotes=%1
set originalpath=%pathwithquotes:~1,-1%
REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Currentversion\RunOnce /v "Del %originalpath% OnNextReboot" /d "cmd.exe /c RD /S /Q  \"%originalpath%\"" /f
endlocal

Delfolder goes into windir or system32.

EDIT: Fixed this with faster code

Link to comment
Share on other sites

This one works:

Delfolderonnextrebootextension.reg

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\Delete on reboot\command]
@="CMD.exe /C start /B /wait /D\"%1\" delfolder.cmd"

Delfolder.cmd

@echo off
CMDOW @ /HID
REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Currentversion\RunOnce /v "Del %cd% OnNextReboot" /d "cmd.exe /c RD /S /Q \"%cd%\"" /f
EXIT

Delfolder goes into windir or system32.

BTW, why do you need this feature???

i allway's have files/folders that are in use

to mutch digging around in windows i guess :lol:

i will test it when i get home

thanks for the reply :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...