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

link|improve this question

65% accept rate
2  
Other than 'del'? – pelms Aug 18 '09 at 16:50
2  
Which OS are you using? – ChrisF Aug 18 '09 at 16:51
exited to add XP and Vista – justintime Aug 18 '09 at 16:59
5  
@pelms del permanently deletes it, not moves it to the recycle bin. – MiffTheFox Aug 18 '09 at 17:02
Why are you looking to move them to the recycle bin? If we can understand your thinking, there may be a better way. – EvilChookie Aug 18 '09 at 17:40
feedback

5 Answers

up vote 10 down vote accepted

CmdUtils has a utility called Recycle that does exactly that.

More info here:

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.

link|improve this answer
feedback

If you have powershell installed:

$sh = new-object -comobject "Shell.Application"
$ns = $sh.Namespace(0).ParseName("PATH\TO\FILE\TO\DELETE")
$ns.InvokeVerb("delete")
link|improve this answer
+1 Any powershell solution will get my vote. I hope the next Windows replaces cmd.exe with PowerShell. – Diago Aug 18 '09 at 17:31
I doubt that will happen for a very long time. :) – EBGreen Aug 18 '09 at 17:31
feedback

I've had this question for a long time -- I finally took the matters into my own hand and I rolled my own utility cmd-recycle

I took a look at Recycle.exe in CmdUtils. The thing about it is that it pops out the traditional "Are you sure" dialog when you recycle (which can be removed by adding the -f argument). My program just does it (since you can always undo) which I think is more suitable for scripting purposes.

link|improve this answer
feedback

In XP, you could try moving the file to one the following paths (took these from an MSDN thread)

C:\RECYCLER\S-1-5-21-1089551744-1120685985-1162132538-1003\

Using the move command of course. Probably something similar in Vista if you can find out what the paths are

Edit: Removed some of the paths because of another post in said thread. You'll need to find these out yourself if you want to do it that way.

link|improve this answer
feedback

I would have to say 'del'

link|improve this answer
3  
But doesn't that permanently delete the files, instead of putting them in recycle bin? – Jonik Aug 18 '09 at 17:04
Yes, permanent delete without recycle is correct, so no, del isn't what you want – Fiasco Labs Dec 25 '11 at 18:18
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.