Deltree Command Replacement in Windows 7, Vista and XP

I was recently required to create a batch file to automatically remove a directory as well as all of its sub-directories and contained files because the excellent Remove Empty Directories tool doesn’t support command line functions. I remembered many years ago when I was using Windows 98, I could use the built in “deltree” command to delete a folder and everything in it.

I launched a Windows command prompt , and typed “deltree /?” to display all the commands for deltree because I couldn’t remember what its parameters are. It was quite embarrassing to see the error message “deltree is not recognized as an internal or external command, operable program or batch file.” The deltree command is no longer used in Windows 2000 and Windows XP, Vista or Windows 7, as the last operating system supporting the deltree command was Windows ME.

deltree is not recognized

After a little searching, I found the deltree command replacement for Windows 2000, XP, Vista and Windows 7. Even though the deltree command has now gone, you can emulate it in newer operation systems with the RD or RMDIR command.


For example, the following DOS command deletes the C:\RAYMOND directory and all sub directories without any warning:


/S = Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree.

/Q = Quiet mode, do not ask if OK to remove a directory tree with /S.

Back in the Windows 98 days, the RD command was used to remove empty directories in MS-DOS. To delete directories with files or directories within them the user had to use the deltree command. It looks like Windows 2000, XP, Vista and 7 have an updated RD command with the /S option to basically merge both deltree and RD into one command. If you didn’t know, the RD and RMDIR are really the same and are internal commands for DOS. You won’t find a file called rd.exe or rmdir.exe in your system.

Using DOS and its commands is still very useful even in today’s modern world of computing. You get to quickly and easily write a DOS batch file to automate tasks or even remove spywares or virus without having an extensive knowledge in other programming languages. Alternatively, you can also use macro software to easily create automated tasks on your computer without knowing a single DOS command.

If for whatever reason you still miss the Deltree command and would like to use it, then you could be in luck. As long as you’re using a 32-bit version of Windows 2000, XP, Vista or 7, then the Deltree tool actually still works just fine on those operating systems, it just wasn’t included with Windows after ME. Deltree won’t work on any 64-bit version of Windows though.

deltree windows 7

Download Microsoft Deltree

Another tool you could use as an alternative to, or replacement for the Deltree command is a third party command line utility called Del3. It also has an advantage over deltree because it works perfectly fine on 64-bit systems although the .NET Framework 3 is required to use it. Type “Del3 /?” into the Command Prompt to get a list of below commands as there is no documentation with Del3.

del3 deltree alternative

There are a few arguments you can use:

del3 C:\RAYMOND = providing no arguments will delete the files in the RAYMOND directory but leave the sub directories and the files inside them alone.

del3 C:\RAYMOND /S = include the sub directories so everything inside the RAYMOND directory will be deleted.

del3 C:\RAYMOND /B = delete the RAYMOND directory itself and everything in it.

There’s also a simulation mode (/I) which you can use to let del3 tell you what it’s going to delete when you use the command without simulation on. The real delete actions are performed without confirmation.

Download Del3

13 Comments - Write a Comment

  1. luiz fernando 2 years ago
  2. Tom Schneider 3 years ago
    • HAL9000 3 years ago
  3. MelisA 4 years ago
  4. Simple Dimple 6 years ago
  5. Raj 6 years ago
  6. he 7 years ago
  7. Milton 7 years ago
  8. dikma 7 years ago
  9. noenoe 7 years ago
  10. Ginni 7 years ago
  11. J 8 years ago
  12. Ralph 9 years ago

Leave a Reply

Your email address will not be published. Required fields are marked *

Note: Your comment is subject to approval. Read our Terms of Use. If you are seeking additional information on this article, please ask in our forum or contact us directly.