For example, if you have a text file, you’ll see “Text Document (. txt)” to the right of the “Type of file” heading. If you see “File folder” listed as the file type, you’ll have to close the Properties window, click once the file you want to check, and then right-click it again and click Properties.
For example, if your file is on the desktop, your command might read cd C:\Users\YourName\Desktop. If you don’t do this step, the “Delete” command will look for your file in a system folder instead.
For a text file named “Bananas”, for example, you would type in “Bananas. txt” as the file name and extension. At this point, the entire second line should read del “file name. extension” where “file name” is replaced by the file’s name and “. extension” is replaced by the file’s extension.
For example, to name your Batch file “fruit”, you would type in fruit. bat here.
Right-click the type of file you want to delete. Click Properties. Look at the extension in the “Type of file” section.
If clicking the address bar doesn’t highlight the address, click and drag across the address to highlight it.
For example, if you want to empty the folder of text files, your “Delete” line would say del “*. txt”.
Click File. Click Save As. . . . Type whatever you want to name your Batch file followed by . bat into the “File name” text box. Click the “Save as type” box, then click All Files. Select a save location on the left side of the window, then click Save.
If you ever move the folder, you’ll need to edit the Batch file to include the updated folder’s address.
This method won’t delete folders inside of the directory, but it will remove all files from those folders.
Type in del and then press the spacebar. Type in /S /Q and then press the spacebar. The “/S” ensures that any folders inside of the main folder also have their files deleted, and the “/Q” removes the confirmation prompt. Paste in the folder’s address from earlier. Type in a backslash (). Type in the folder’s name exactly as it appears in the address bar when you open the folder.
Click File. Click Save As. . . . Type whatever you want to name your Batch file followed by . bat into the “File name” text box. Click the “Save as type” box, then click All Files. Select a save location on the left side of the window, then click Save.