Securely Deleting Files on Windows - sdelete

Posted on Tue 12 April 2016 in howto

SDelete is a free utility from Sysinternals (now MS TechNet) which securely deletes files on Windows.

Sdelete supports the following options:

    C:\Users\ubahmapk> sdelete /?

    SDelete - Secure Delete v1.61
    Copyright (C) 1999-2012 Mark Russinovich
    Sysinternals -

    usage: C:\tools\sdelete.exe [-p passes] [-s] [-q] <file or directory> ...
    C:\tools\sdelete.exe [-p passes] [-z|-c] [drive letter] ...
    -a         Remove Read-Only attribute
    -c         Clean free space
    -p passes  Specifies number of overwrite passes (default is 1)
    -q         Don't print errors (Quiet)
    -s or -r   Recurse subdirectories
    -z         Zero free space (good for virtual disk optimization)

It's a good utility and one I used from the command line for quite awhile, but in order to use it, I had to be at the command line - I couldn't just select a file in Explorer and delete away...

Then a few years ago I came across a forum post with instructions on how to add the SDelete utility to the right-click menu in Windows, so that secure file deletion was much simpler. (Most of what's below is taken from that post, but I've updated the location of the SendTo folder for newer versions of Windows.)

The sdelete.bat script itself is extremely simple, and is taken nearly verbatim from the forum posting:

    @echo off

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

      sdelete -p 3 -s -a -q %1

      goto START

Save the above BAT file in your SendTo folder, located at %UserProfile%\AppData\Roaming\Microsoft\Windows\SendTo. Once the file is there, you should be able to right-click on any file or folder in Explorer and select Send to -> sdelete.bat.

Of course, sdelete is not the only utility that can securely delete files on Windows, and perhaps I'll cover others down the line.