SEARCH

The How-To Geek Forums Have Migrated to Discourse

How-To Geek Forums / Geek Stuff

(Solved) - comand line instruction to empty recycle bin

(14 posts)
  • Started 1 year ago by LarrySr
  • Latest reply from LarrySr
  • Topic Viewed 673 times

LarrySr
LarrySr
Posts: 270

I am writing a routine that requires me to empty the recycle bin. Is there a "command line" instruction that can empty the recycle bin?

Posted 1 year ago
Top
 
doctordeere
doctordeere
Posts: 164

You could use NirSoft's NirCmd to do that.

nircmd.exe emptybin

http://www.nirsoft.net/utils/nircmd.html

Posted 1 year ago
Top
 
raphoenix
raphoenix
Posts: 14920

Right Click Recycle Bin.

Choose Properties in menu.

Check Mark Box [ Do Not Move Files to Recycle Bin. Remove Files Immediately. ]

Do that for all storage drives.

Reboot.

Now all deletions will NOT go to Recycle Bin but will be deleted immediately from the disk.

Posted 1 year ago
Top
 
LarrySr
LarrySr
Posts: 270

This has to be a command that can be executed as part of a BASIC language program. This program will be doing a lot of other things also and the command will compiled as part of the overall program into an executable file. When specific test are passed it will then empty the recycle bin.

Posted 1 year ago
Top
 
ronniesonora
Posts: 919

Should be rd /s %systemdrive%\$Recycle.bin

Posted 1 year ago
Top
 
LarrySr
LarrySr
Posts: 270

ronniesonora; this will delete everything in the recycle bin and then it will attempt to delete the recycle bin which Windows will not permit and which I do not want to do.

Posted 1 year ago
Top
 
ronniesonora
Posts: 919

LarrySr, what os are you using?

Posted 1 year ago
Top
 
Lighthouse
Lighthouse
Posts: 13598

You can delete the recycle bin. It will remake itself.

Posted 1 year ago
Top
 
LarrySr
LarrySr
Posts: 270

ronniesonora; I am running Windows 7 but I will be creating an exe that should run regardless of which os I am running.

Lighthouse; Windows will not let me delete the recycle bin. It gives me an "access denied" when I attempt to use the RD command on the recycle bin.

Posted 1 year ago
Top
 
Lighthouse
Lighthouse
Posts: 13598

I just right click, and Take Ownership first.

Posted 1 year ago
Top
 
LarrySr
LarrySr
Posts: 270

Lighthouse; right click on what? How do I take ownership?

Posted 1 year ago
Top
 
Lighthouse
Lighthouse
Posts: 13598

http://www.howtogeek.com/howto.....-in-vista/

Posted 1 year ago
Top
 
ronniesonora
Posts: 919

LarrySr, try this rd /s c:\$Recycle.Bin

Posted 1 year ago
Top
 
LarrySr
LarrySr
Posts: 270

Lighthouse; thanks for the link to the addon for "take ownership".

I took something from several of the suggestions above and I believe I have come up with a workable solution to my problem. Thanks everyone.

Accepted Answer · Posted 1 year ago
Top
 



Topic Closed

This topic has been closed to new replies.

Enter Your Email Here to Get Access for Free:

Go check your email!