Advertisement
Guest User

Force-empty Recycle Bin

a guest
Jun 25th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.39 KB | None | 0 0
  1. @echo off
  2. pushd %~dp0
  3. net session >nul 2>&1
  4. if %errorlevel%==0 (
  5.     goto removal
  6. ) else (
  7.     goto noadmin
  8. )
  9.  
  10. :noadmin
  11. echo This script needs to be ran as administrator in order to work.
  12. goto quit
  13.  
  14. :removal
  15.  
  16. takeown /f "%homedrive%/$RECYCLE.BIN" /r /d y
  17. icacls "%homedrive%/$RECYCLE.BIN" /grant everyone:F /t /q
  18. rmdir /s /q "%homedrive%/$RECYCLE.BIN"
  19. goto quit
  20.  
  21. :quit
  22. popd
  23. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement