Sysinternals Homepage
Forum Home Forum Home > Sysinternals Utilities > Miscellaneous Utilities
  New Posts New Posts RSS Feed - My handy sdelete scripts
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedMy handy sdelete scripts

 Post Reply Post Reply Page  123 6>
Author
Message
soulstace View Drop Down
Groupie
Groupie
Avatar

Joined: 07 January 2006
Status: Offline
Points: 49
Direct Link To This Post Topic: My handy sdelete scripts
    Posted: 25 May 2006 at 6:28pm
- Script #1 : Shred Files using Send To

With this script you can easily shred any file by right-clicking on it > Send To > sdelete.bat Even if you don't have permissions on the file or if it is system or hidden file!


Requirements:
  1. For each of these scripts to work properly, Sysinternals sdelete.exe must exist in your PATH (normally the C:\Windows\System32 directory, or %systemroot%\System32)

    You can download sdelete (in zipped form) from here if you don't have it already.


  2. You should be logged on as an Administrator when trying to shred files in which you don't currently have the necessary permissions to access or delete.




Instructions:

Create a .bat file using notepad or your favorite text editor. Put the following code into it and save it in your "SendTo" folder (i.e. C:\Documents and Settings\%username%\SendTo) as sdelete.bat


ECHO Y| cacls %1 /T /C /G Administrators:F
attrib -h -s -r -a %1 /S /D
sdelete -p 3 -s -q %1


Now just right-click on any file you wish to shred and go Send To > sdelete.bat and it will shred it using sdelete's secure 3 pass method.

Neat trick ey? No more typing anything in from the command line! I hope someone will find this as useful as I did!! :)



- Script #1 (Updated) -

Thanks to Karlchen's batch skills, and other members suggestions, we now have a revised script that will work better at sdeleting multiple files and directories at the same time.

Follow the same instructions as above for creating and saving the batch file, but using the following code instead.


@echo off

:START
if "%~f1"=="" (
   echo No more args given. Done.
   exit /b 0
)

:WORK
   ECHO Y| cacls %1 /T /C /G Administrators:F
   attrib -h -s -r -a %1 /S /D
   attrib -h -s -r -a %1\*.* /S /D
   sdelete -p 3 -s -q %1

:NEXTARG
   shift
   goto START


Thanks again everyone for all of your help on improving my original script :)



- Script #2 : Context menu (right-click) to Zap Free Space

With this script you will be able to right click on any drive or partition to zap free space with sdelete!

Instructions:

Copy/paste the code from below into notepad. Save it somewhere as context_sdelete.inf then right-click on context_sdelete.inf and go Install.


; context_sdelete.inf
; Adds Zap Free Space to the right click context menu in Windows XP
[version]
signature="$CHICAGO$"
[DefaultInstall]
AddReg=AddMe
[AddMe]
HKCR,"Drive\Shell\Zap Free Space\command",,,"sdelete -p 3 -z %1"


Now you can right-click on a drive icon in My Computer to Zap Free Space on that drive!


Notes:

If you're having problems making the INF or BAT files, make sure Save as type: "All Files" is selected in Notepad's save dialog.

Thanks Sysinternals for this wonderful tool! :)

I hope I helped to make everyone's life a little easier, and they get good use out of my scripts. ;) Enjoy all! :D

Edited by soulstace - 16 June 2006 at 8:26pm
Back to Top
EP_X0FF View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 March 2006
Location: Russian Federation
Status: Offline
Points: 4753
Direct Link To This Post Posted: 26 May 2006 at 12:46pm
wow, thanks. really working
Back to Top
GreenHornet View Drop Down
Groupie
Groupie
Avatar

Joined: 04 June 2005
Location: Finland
Status: Offline
Points: 69
Direct Link To This Post Posted: 27 May 2006 at 7:25am
Really nice, but just one thing. Cacls doesn't support /Y switch. => http://www.microsoft.com/.../cacls.mspx

Workaround would be:

ECHO Y| cacls %1 /T /C /G Administrators:F

But no guarantee that it works.


Edited by GreenHornet - 27 May 2006 at 7:27am
Back to Top
soulstace View Drop Down
Groupie
Groupie
Avatar

Joined: 07 January 2006
Status: Offline
Points: 49
Direct Link To This Post Posted: 27 May 2006 at 8:05am
Indeed I actually became aware of this syntax yesterday, and then updated my own script accordingly. I will try and update my first post now. Thanks!

Edited by soulstace - 27 May 2006 at 8:09am
Back to Top
soulstace View Drop Down
Groupie
Groupie
Avatar

Joined: 07 January 2006
Status: Offline
Points: 49
Direct Link To This Post Posted: 27 May 2006 at 9:16am
Check this! I updated it with a FOR loop. Now you can select and shred multiple files and/or directories at once!

EDITED - Check the original post for final script.

Edited by soulstace - 16 June 2006 at 7:08pm
Back to Top
EP_X0FF View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 March 2006
Location: Russian Federation
Status: Offline
Points: 4753
Direct Link To This Post Posted: 27 May 2006 at 9:20am
you are the man!
Back to Top
soulstace View Drop Down
Groupie
Groupie
Avatar

Joined: 07 January 2006
Status: Offline
Points: 49
Direct Link To This Post Posted: 27 May 2006 at 9:29am
Thank you, thank you very much.

Edited by soulstace - 16 June 2006 at 8:28pm
Back to Top
Pleonasm View Drop Down
Newbie
Newbie


Joined: 21 November 2005
Status: Offline
Points: 10
Direct Link To This Post Posted: 04 June 2006 at 12:05pm

Soulstace, EP_X0FF, and GreenHornet:  Are you all using SDelete on Windows XP?  If so, have you observed any problems?

 

Note that Windows XP is not listed as a supported operating system for SDelete by Sysinternals.

Back to Top
GreenHornet View Drop Down
Groupie
Groupie
Avatar

Joined: 04 June 2005
Location: Finland
Status: Offline
Points: 69
Direct Link To This Post Posted: 05 June 2006 at 3:47pm
I use Win2K
Back to Top
EP_X0FF View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 March 2006
Location: Russian Federation
Status: Offline
Points: 4753
Direct Link To This Post Posted: 06 June 2006 at 12:02am
I use WinXP
Back to Top
 Post Reply Post Reply Page  123 6>
  Share Topic   

Forum Jump Forum Permissions View Drop Down