Advertisement
efxtv

Delete files using batch script. Delete files in Home folders and Drive (Windows10/7)

Oct 13th, 2023 (edited)
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | Cybersecurity | 0 0
  1. Delete files using batch script. Delete files in Home folders and Drive (Windows10/7) CMD script
  2.  
  3. Note:- Please test this script on a virtual Windows 10/7 environment. Do not attempt to run it on a non-native batch system, as any damage incurred may not be recoverable. Before testing, carefully review the script and make any necessary adjustments.
  4.  
  5. Telegram post: https://t.me/efxtv/2842
  6.  
  7. Usage of the script:-
  8. With a single click, you can delete files with selected extensions in the home folders of the C: drive, as well as on the E:\ and F:\ drives.
  9.  
  10. # Save the script as delete.bat in Windows10/7
  11.  
  12. @echo off
  13. setlocal enabledelayedexpansion
  14.  
  15. set "target_exts=jpg exe"
  16. set "drive=C:\Users\%USERNAME%\"
  17. set "drives=E:\"
  18. set "drivess=F:\"
  19.  
  20. :: Delete in Downloads Desktop Music Picture etc
  21. for %%X in (%target_exts%) do (
  22. for /r %drive% %%F in (*%%X) do (
  23. del "%%F" /q /f > nul 2>&1
  24. )
  25. )
  26.  
  27. :: Delete in drive E:\
  28. for %%X in (%target_exts%) do (
  29. for /r %drives% %%F in (*%%X) do (
  30. del "%%F" /q /f > nul 2>&1
  31. )
  32. )
  33.  
  34. :: Delete drive F:\, You can create many
  35. for %%X in (%target_exts%) do (
  36. for /r %drivess% %%F in (*%%X) do (
  37. del "%%F" /q /f > nul 2>&1
  38. )
  39. )
  40. echo Deletion process completed.
  41. pause
  42.  
  43. ▬▬▬▬▬▬⋆★⋆ ▬▬▬▬▬▬
  44. One time fee life time access
  45. 🗺 | DM: @errorfix_tv
  46. ▬▬▬▬▬▬⋆★⋆ ▬▬▬▬▬▬
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement