What is the command line way of sending files to the recycle bin?

Is there a command line program that can send files to the recycle bin? This is on XP and Vista.


CmdUtils has a utility called Recycle that does exactly that. [direct download]

More info:

To use the recycle command download the CmdUtils zip file and unzip the exe to your Windows folder. Adding them to the Windows folder would allow you to access the command globally without you having to specify the entire path to the executable. You can then start using the recycle command by typing in;

recycle filename.txt

You can also specify wildcards with the commands so typing in recycle *.txt will recycle any text files in the current directory. There is also a option to suppress the delete confirmation dialog by using the force flag with the command.

To delete a file without having to confirm is use the command

recycle –f filename.txt

The –f flag will tell the command to force a recycle without showing you the confirmation dialog.


If you have powershell installed:

$sh = new-object -comobject "Shell.Application"
$ns = $sh.Namespace(0).ParseName("PATH\TO\FILE\TO\DELETE")
$ns.InvokeVerb("delete")