This wikiHow teaches you how to delete computer files using the Command Prompt.
Step
Part 1 of 2: Preparing the Files You Want to Delete
Step 1. Find the file you want to delete
If you know the location of the file you want to delete, you can find it by opening the directory (folder) that contains it. For example, if you try to delete an image or text file, you may find it in the " Documents " directory. This directory is the default directory where document files are stored.
If you don't know the location of the file that you want to delete, type the name of the file in the search field under the "Start" menu. After the search field finds the file, right-click the file and select the option " Open file location " to open the directory containing the file.
Step 2. Click and drag your files to the Desktop
Moving files to the Desktop makes the deletion process easier because you don't have to change the file's deletion location at the Command Prompt.
If the file you want to delete is in the " System 32 " directory where the Windows system files are located, you do not need to move them
Step 3. Right-click the file
This will open a drop-down menu.
Step 4. Click the Properties option
It's at the end of the drop-down menu.
Step 5. Look at the Filename Extension of the file
After opening the " Properties " window, take a look at the Filename Extension (the letters that indicate the type of file, such as.exe,.docx,.txt, etc.) for the file listed to the right of the text "Type of file: ". The text is in the "General" tab. You must know the file's Filename Extension to be able to delete it using the Command Prompt. Here are some Filename Extensions that are commonly found:
- .txt - Text file (file created using Notepad).
- .docx - Microsoft Word file.
- -j.webp" />
- .mov,.wmv,.mp4 - Video files.
- .mp3,.wav - Sound files.
- .exe - Executable file (file used to run applications or install programs).
- .lnk - Shortcut file. Deleting a Shortcut will not delete the program connected to the Shortcut.
Step 6. Write the Filename Extension
Once you know the file's Filename Extension, you can open it and use the Command Prompt to delete it.
Part 2 of 2: Deleting Files Using Command Prompt
Step 1. Open Command Prompt
You should not use Command Prompt in " Administrator " (or " Admin ") mode to delete files, unless you want to delete files that are in the " System 32 " directory. You can open Command Prompt using the following methods depending on the Windows version:
- Press and hold the Win key and the X key. After that, click Command Prompt that appears above the Start button.
- Right-click the Start button in the lower-left corner of the screen and click Command Prompt which is in a pop up window (a small window containing certain information).
- Type "Command Prompt" in the search field in the Start menu (if using Windows 8, move the cursor to the upper-right corner of the window and click the symbol that looks like a magnifying glass), and click the "Command Prompt" icon when it appears.
- Open the program " Run " in the Start menu. After that, type "cmd" and click the "OK" button.
Step 2. Type cd desktop and press Enter key
This will change the default location (or directory) in Command Prompt to the "Desktop" location.
- There are other ways to change the Command Prompt directory if needed.
- Opening Command Prompt in " Administrator " mode will change the default Command Prompt directory to " System32 " directory. Therefore, you should not open Command Prompt in " Administrator " mode, unless the files you want to delete are in the " System 32 " directory.
Step 3. Type del [filename filetype]
Replace "filename.filetype" with the name and Filename Extension of the file.
- For example, an image file named "house" would become home.png, while a text file named "notes" would become notes.txt and so on.
- If the name of the file you want to delete contains spaces, put quotation marks at the beginning and end of the file name such as "PantaiAncol.jpg", not Pantai_Ancol.jpg.
- To delete all files on the "Desktop" that have the same Filename Extension (such as all text or image files), type *.filetype. The word "filetype" is replaced with the Filename Extension of the file you want to delete, such as *.txt.
Step 4. Press Enter key
After pressing the key, you will see a new blank line appear in the Command Prompt. This indicates that the file has been deleted.
The command (command) " del " deletes files directly from the hard drive, not in the Recycling Bin. Therefore, you do not have to delete any more files from the Recycling Bin
Tips
We recommend that you use Windows Explorer to delete files. Use the Command Prompt to forcibly delete the file
Warning
- If you delete Windows system files, your computer may experience a system crash and won't start.
- Files deleted using the Command Prompt will not be dumped into the Recycling Bin.