How to Delete a File in Microsoft Windows Using Batch Files

Open Notepad., Type "cd" into Notepad (without quotes). , Find the directory/file which you want to delete, then right click it and choose Properties. , In the properties box, copy the information listed as "Location". , In Notepad, space once after...

23 Steps 1 min read Advanced

Step-by-Step Guide

  1. Step 1: Open Notepad.

    To open Notepad, click Start>All Programs>Accessories>Notepad.
  2. Step 2: Type "cd" into Notepad (without quotes).

    ,,, For example, if I copied C:\users\administrator, then I would have "C:\users\administrator" (with quotes).

    If you want to delete files from a specific location, but the file in that location doesn't exist, start from step 5, typing the path to the location. ,,, If I want to delete a file called music.wav, I type del "music.wav". ,,,,, If the steps were followed correctly, the file/folder should delete.

    If you receive a confirmation and you want to delete the file/folder, type Y and press Enter.
  3. Step 3: Find the directory/file which you want to delete

  4. Step 4: then right click it and choose Properties.

  5. Step 5: In the properties box

  6. Step 6: copy the information listed as "Location".

  7. Step 7: In Notepad

  8. Step 8: space once after "cd" and paste what you copied

  9. Step 9: then type a quote at both ends of it.

  10. Step 10: press Enter on your keyboard to switch to a different line.

  11. Step 11: Type "del" in Notepad (without quotes) on the new line.

  12. Step 12: Space once

  13. Step 13: and type the name of the folder or file along with its extension (if any) that you want to delete in quotes.. For example

  14. Step 14: deleting a folder called Delete Me means that I have to type del "Delete Me".

  15. Step 15: At the top of Notepad

  16. Step 16: click File>Save As.

  17. Step 17: In the Save As window

  18. Step 18: choose the Save as Type as "All Files".

  19. Step 19: As the File Name

  20. Step 20: type "yourname.bat" (without quotes) with any name you want in place of "yourname".

  21. Step 21: Click Save.

  22. Step 22: Locate the new file where you saved it at

  23. Step 23: and double click it.

Detailed Guide

To open Notepad, click Start>All Programs>Accessories>Notepad.

,,, For example, if I copied C:\users\administrator, then I would have "C:\users\administrator" (with quotes).

If you want to delete files from a specific location, but the file in that location doesn't exist, start from step 5, typing the path to the location. ,,, If I want to delete a file called music.wav, I type del "music.wav". ,,,,, If the steps were followed correctly, the file/folder should delete.

If you receive a confirmation and you want to delete the file/folder, type Y and press Enter.

About the Author

N

Nathan Martin

Writer and educator with a focus on practical pet care knowledge.

29 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: