Advertisement
Thibstars

emptyRecycleBin

May 26th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.78 KB | None | 0 0
  1. @echo off
  2.  
  3. :ASK
  4. SET /P IN=Are you sure you'd like to empty your entire recycle bins? [y/n]
  5. goto CHECKIN
  6.  
  7. :ASKAGAIN
  8. echo Wrong input, please type y/n as answer.
  9. goto ASK
  10.  
  11. :CHECKIN
  12. IF /I "%IN%"=="y" goto CLEARBIN
  13. IF /I "%IN%"=="n" goto CANCEL
  14. IF [%IN%]==[] goto ASKAGAIN
  15.  
  16. ::Check input is exactly "y" or "n"
  17. echo %IN% | findstr /r "^[^yn]*(y|n){1}[^yn]*$*" >nul 2>&1 && (echo []) || (goto ASKAGAIN)
  18.  
  19. :CLEARBIN
  20. echo Emptying system recycle bin...
  21. rd /s /q %systemdrive%\$Recycle.bin
  22. echo Ready emptying system recycle bin!
  23. echo Emptying desktop recycle bin...
  24. rd /s /q D:\$Recycle.bin
  25. echo Ready emptying desktop recycle bin!
  26. echo ===================================
  27. echo All recycle bins emptied!
  28. goto END
  29.  
  30. :CANCEL
  31. echo Canceled emptying recycle bin.
  32. goto END
  33.  
  34. :END
  35. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement