How to Delete a File Using Command Prompt
Part 1 of 2:
Preparing Your File for Deletion
- Locate your file. If you know where the file is, you can navigate to it by simply opening the appropriate folder. For example, if you're trying to delete a picture or a text file, you will likely want to look in the default "Documents" folder, which typically holds those file types.
- If you don't know where your file is, type its name into the Start search bar, right-click the file when it pops up, and click Open file location to go directly to the file.
- Click and drag your file onto the desktop. Doing so will make the deletion process easier as you won't have to change the deletion location from within Command Prompt.
- The exception to this rule is if you're trying to delete a file from the "System32" folder, which is Windows' system files folder. If that's the case, leave your file there.
- Right-click your file. This will prompt a drop-down menu.
- Click Properties. It's at the bottom of the drop-down menu.
- Look at the file extension. The file's extension is listed near the top of the "General" tab in the "Properties" window, to the right of the "Type of file:" text. You'll need to know your file's extension in order to delete it using Command Prompt. Common extensions include the following:
- .txt - Text files (files made in Notepad).
- .docx - Microsoft Word files.
- .jpg or .png - Picture files.
- .mov, .wmv, .mp4 - Video files.
- .mp3, .wav - Sound files.
- .exe - Executable files (e.g., a setup file).
- .lnk - Shortcut files. Deleting a shortcut will not remove the attached program from your computer.
- Write down the file extension. Once you know the file extension, you're ready to open and use Command Prompt.
Part 2 of 2:
Deleting the File with Command Prompt
- Open Command Prompt. In this case, you'll want to avoid the "Administrator" (or "Admin") version of Command Prompt unless you're deleting a file in the "System32" folder. You can open Command Prompt in a variety of ways depending on your version of Windows:
- Hold down ⊞ Win and press X, then click Command Prompt above the Start button.
- Right-click the Start button in the bottom-left corner of the screen, then click Command Prompt in the pop-up window.
- Type "Command Prompt" into the Start menu search bar (for Windows 8, hover your mouse in the top-right corner of the screen and click the magnifying glass), then click the "Command Prompt" icon when it appears.
- Open the "Run" app from the Start menu, type in "cmd", and click OK.
- Type in cd desktop and press ↵ Enter. Doing so will change the location (or "directory") in Command Prompt to your desktop.
- There are other ways you can change the Command Prompt directory if need be.
- Opening Command Prompt in "Administrator" mode will change the directory to the "System32" file. For this reason, do not open Command Prompt in "Administrator" unless your file is in the "System32" folder.
- Type in del [filename.filetype]. Replace "filename.filetype" with your file's actual name and extension.
- For example, a picture file named "icecream" would become icecream.png, a text file named "notes" would become notes.txt, and so on.
- For files with spaces in their names, place quotation marks around the entire file name: "I like turtles.jpg" instead of I_like_turtles.jpg or similar.
- To delete all files on your desktop that share the same extension (e.g., all text files), type *.filetype where "filetype" is the extension (e.g., *.txt).
- Press ↵ Enter. You will see a new, blank line appear in Command Prompt. Your file is now gone.
- Since the "del" command removes files directly from your hard drive, you won't need to delete the file again from the Recycling Bin.
4.5 ★ | 2 Vote
You should read it
- How to use the command history function in Command Prompt
- How to Launch Python Files Using Windows Command Prompt
- How to Create and Delete Files and Directories from Windows Command Prompt
- How to Make Command Prompt Appear at School
- How to Copy Files in Command Prompt
- How to Unblock Command Prompt Anywhere
- Windows prompt
- 10 useful commands in Windows you should know
May be interested
- Tips to burn ISO file from Command Prompt on Windows 10windows 10 also allows users to burn iso files without having to use any 3rd party software or tools. actually burning iso files doesn't need to use the first integrated third tool on windows 7. all you need is a blank cd / dvd and iso file.
- How to Add and Delete Users Accounts With Command Prompt in Windowscommand prompt, which is essentially windows' version of apple's 'terminal' app, allows you to enter system-altering commands. while most user commands one might enter in command prompt are easier to carry out by simply performing the...
- How to Open Folders in CMDdo you need to access something from the command prompt or the windows command prompt? although it looks classic, this program is really easy to use if you know some basic commands. today's tipsmake will show you how to use the 'cd' command to open a folder in windows command prompt. besides, you will also know more great tips to instantly open command prompt in any folder on windows file explorer.
- Add Command Prompt to Power User Menu on Windows 10on windows 10 build 14971, microsoft replaced command prompt and command prompt (admin) with windows powershell. according to microsoft, this change will bring the best command line experience to users. but in fact, users prefer to use command prompt rather than using powershell.
- How to Delete Undeletable Files in Windowssometimes you are faced with an error when you try to delete a file permanently. it may be spyware, malware, ad-ware or any trojan. in some situations, the file is being used by the essential windows programs such as windows explorer,...
- How to delete the user and the machine name in the command prompt on Terminalfor linux users (or macs) using terminal, you will see that the default prompt will have the format [username @ hostname ~] $. please note that this is only the default setting and you can freely change it.
- How to open Command Prompt on Windows 10, 8, 7, Vista and XPcommand prompt is one of the command line interface programs used to execute commands in the windows operating system. the article will guide you how to open command prompt on windows 10, 8, 7, vista and xp.
- How to Copy Files in Command Promptthis wikihow teaches you how to use windows' command prompt program to copy a file or folder. find out your file's location. you'll need the file's location—also known as a 'directory'—in order to tell command prompt where to look for the f...
- 6 Best Command Prompt Alternatives for Windowsdo you find the command prompt a bit complicated and feel you need a tool that is easier to use? this is where other terminal emulators come into play!
- How to use Xcopy command in Command Promptknowing how to use xcopy command in command prompt, you will easily use commands in cmd professionally. in particular, the xcopy command is extremely useful for those who copy and copy data on the computer.