Deltree Command Replacement in Windows: How to Setup
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.
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:
RD C:\RAYMOND /S /Q
/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.
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.
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.
Simply use the native “del” command in windows …
See the parameters by typing the command “del /?”.
Use simplesmente o comando “del” nativo do windows…
Veja os parâmetros do comando digitando “del /?”.
I had used deltree c: in the past to clear a hard drive, Will Del3 do this?
I have a Win 8.1 laptop I would use this on.