This article explains how to delete a file from the desktop of a Windows computer using the command line.
Steps
Part 1 of 2: Preparing a file for deletion

Step 1. Select a file
If you know where the file is located, navigate to it by opening the appropriate folder. For example, if you want to delete an image or text file, most likely it is located in the Documents folder, which by default stores files of this format.
If you don't know where the file is located, enter its name in the Start menu search bar, then right-click on it and select File Location from the menu to navigate directly to the file

Step 2. Drag the file to your desktop
This will simplify the uninstallation process by eliminating the need to navigate to the appropriate directory on the command line.
The exception to this rule is when a file is deleted from the System32 folder, which is the Windows system folder. In this case, leave the file in this folder

Step 3. Right-click on the file
A dropdown menu will open.

Step 4. Click Properties
It's near the bottom of the menu that opens.

Step 5. Find out the file extension
The file extension is displayed on the General tab of the Properties window in the File Type row. You need to know the file extension in order to remove it using the command line. The most common extensions are:
- .txt - text files (created in Notepad).
- .docx - Microsoft Word files.
- -j.webp" />
- .mov,.wmv,.mp4 - video files.
- .mp3,.wav - audio files.
- .exe - executable files (for example, installation files).
- .lnk - shortcuts. Removing a shortcut will not delete the corresponding file (program).

Step 6. Take note of the file extension
Now you can open and use the command line.
Part 2 of 2: Deleting a File Using the Command Line

Step 1. Open Command Prompt
You need to open the command line without administrative rights, unless you are going to delete the file from the system folder "System32". You can open the command prompt in different ways depending on the version of Windows:
- Hold down the ⊞ Win key, press X, and then click Command Prompt above the Start button.
- Right-click on the "Start" button (in the lower left corner of the screen) and select "Command Prompt" from the menu.
- In the Start menu search bar, type Command Prompt (without the quotes; in Windows 8, move your mouse cursor to the upper-right corner of the screen and click the magnifying glass icon) and click Command Prompt when the corresponding icon appears.
- From the Start menu, click Run, type cmd (without the quotes) and click OK.

Step 2. Type cd desktop and press Enter
This will change you to the directory corresponding to your desktop on the command line.
- If necessary, use other methods to change the directory at the command line.
- If you open Command Prompt as Administrator, you will automatically move to the "System32" directory (folder). Therefore, do not open a command prompt with administrative rights unless the file to be deleted is located in the System32 folder.

Step 3. Enter del [name
extension]. Replace "name.extension" with the name and extension of the file to be deleted.
- For example, if you want to delete the image called "icecream", enter icecream.png, and if the text file called "notes", enter notes.txt (and so on).
- If the file name contains spaces, the file name and extension must be enclosed in quotation marks: "I like turtles.jpg" instead of I_like_turtles.jpg.
- To remove all files with the same extension (for example, all text files) from the desktop, enter *.extension, where replace “extension” with the appropriate extension (for example, *.txt).

Step 4. Press ↵ Enter
A new blank line will appear on the command line.
The "del" command deletes files directly from the hard drive, that is, you do not need to delete them from the Recycle Bin again
Advice
It is better to use a file manager to delete files. Use the command line to delete files that are difficult to get rid of
Warnings
- Deleting a system file can crash the system.
- Files that are deleted via the command line do not end up in the Trash.