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...
Step-by-Step Guide
-
Step 1: Open Notepad.
To open Notepad, click Start>All Programs>Accessories>Notepad. -
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. -
Step 3: Find the directory/file which you want to delete
-
Step 4: then right click it and choose Properties.
-
Step 5: In the properties box
-
Step 6: copy the information listed as "Location".
-
Step 7: In Notepad
-
Step 8: space once after "cd" and paste what you copied
-
Step 9: then type a quote at both ends of it.
-
Step 10: press Enter on your keyboard to switch to a different line.
-
Step 11: Type "del" in Notepad (without quotes) on the new line.
-
Step 12: Space once
-
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
-
Step 14: deleting a folder called Delete Me means that I have to type del "Delete Me".
-
Step 15: At the top of Notepad
-
Step 16: click File>Save As.
-
Step 17: In the Save As window
-
Step 18: choose the Save as Type as "All Files".
-
Step 19: As the File Name
-
Step 20: type "yourname.bat" (without quotes) with any name you want in place of "yourname".
-
Step 21: Click Save.
-
Step 22: Locate the new file where you saved it at
-
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
Nathan Martin
Writer and educator with a focus on practical pet care knowledge.
Rate This Guide
How helpful was this guide? Click to rate: