How to delete files via command line in Windows OS

Table of contents:

How to delete files via command line in Windows OS
How to delete files via command line in Windows OS
Anonim

Currently, there is specialized software for removing unnecessary files from a personal computer. In turn, the Windows operating system also has a built-in application for removing programs, games and other software. But some users do not like the services provided by third-party software and standard OS tools. In this case, it remains to resort to the help of the console, known to users of the Windows operating system as the command line.

command line on startup
command line on startup

Using the built-in console, you can delete a file before the computer is fully loaded. This can come in handy if a malicious folder or document is blocking the startup of the operating system. This material discusses in detail how to delete files through the command line in the Windows OS.

Remove Junk Files with Third Party Software

Today, there are many companies creating specialized software for removing junk files, as well as completely uninstalling installed applications, games and various multimedia programs. Using this kind of software, you, first of all, facilitate the maintenance of your computer and at the same time increase the life of your hard drive. Many users have no idea how to delete files through the command line, and most importantly, is it possible.

trash removal software
trash removal software

Modern junk cleaner applications have many features, from clearing the cache to fixing holes in the computer's security. The leaders among cleaning software companies are Wise, IObit, Auslogics, Priform. With the systematic cleaning of a personal computer from unnecessary files, its performance increases. But with all the advantages of this third-party software, it does not allow you to permanently delete files, folders and programs.

Delete files and applications using standard Windows tools

You can delete folders, files and programs through a special system application. These actions are also performed manually, followed by cleaning the registry of the operating system. The main disadvantage of the procedure is that the remaining path to the file is stored on the computer, located in different directories. That is why specialized software for cleaning a personal computer was developed. junk folderfiles will not interfere with the work, but it will take up a lot of disk space. You can only remove it manually, if you do not resort to using the console.

uninstall with regular windows tool
uninstall with regular windows tool

Deleting files via the command line: nuances

Given all of the above, the question arises: why and how to delete files through the command line, if it's easier to remove them using, for example, CCleaner or the Windows system uninstaller. The answer is simple: it is necessary, first of all, to delete a file without the possibility of its recovery. And also in case of emergency blocking the launch of "Windows" by malicious software.

command line
command line

Before selling a used computer, many users resort to deleting folders and files through the command line, as it ensures that the information will not be restored.

How to delete files via command line

Given the information above, let's proceed directly to deleting information via the command line. In order to carry out this operation, follow the detailed instructions below:

command line instruction
command line instruction
  1. Press the Win+R keys.
  2. In the system interpreter window that opens, type cmd command.
  3. In the console that opens, write the command DEL /F /S /Q /A "Full path of the element with extension".
  4. Example: DEL /F /S /Q /A "C:\Games\COD2.exe", where the folder is games, COD2.exe is the name of the file withits extension (exe).
  5. Confirm the action by pressing the "Enter" key.

Thus, you can clear any folder from unnecessary txt files using the command line. Next, we will look at how to delete all files located in a folder along with it.

Deleting files with and without confirmation: command line to help

You can delete not only one file, but also the entire contents of disks, including directories and their subfolders. It is required to confirm or reject actions with keys called Y - yes / N - no, in order to delete all files in the main directory and the folder tree nested in it. Follow the guide below to perform a full uninstall using the console:

windows command line
windows command line
  1. Type the following command into the command line to confirm deletion of all files: DEL /F /S /Q /A "Full path to folder\".
  2. To delete files, use the command: DEL /F /S /Q /A "D:\to recycle bin\", where D:\ is a drive (it may be different for you), "to recycle bin" - the destination of the file or folder to be deleted.
  3. To delete a confirmation file, add /P, in which case the command will look like this: DEL /P /F /S /A "D:\course\", where "course" is the file name.
  4. You can delete all files of the same extension from a folder, to execute, write the command DEL /F /S /Q /A "Full path to the folder\extension", where "extension" is the file type (for example, exe.)

Referring to the above instructions, it is clear that using the command line, you can quickly and efficiently delete files from your computer. With sufficient skill, such operations are carried out in a matter of seconds.

Conclusion

Thus, from this article you could learn how to delete files through the command line while applying various data cleaning methods. Also in this material, other methods were considered for removing system debris and files from a PC using third-party software and standard Windows tools. If something doesn't work the first time, try repeating the above steps.

Popular topic

Editor's choice

  • Restore Skype account: step by step instructions, return access to your account
    Restore Skype account: step by step instructions, return access to your account

    Don't know how to recover your Skype account? Or do you want to know your friend's Skype password? The article discusses several ways to restore the user's page, as well as recommendations for storing and selecting pin codes

  • Why can't I follow on Instagram? All possible reasons
    Why can't I follow on Instagram? All possible reasons

    We subscribe to people with a specific goal - to find friends, like-minded people of interest, to learn something new for ourselves. And sometimes it is very strange to see that the Instagram system does not allow you to "follow" the profile you are interested in. This error occurs quite often, no one is immune from this trouble. Let's analyze the main reasons why Instagram does not allow you to subscribe to people

  • How to find out who "liked" a person on Instagram. Proven Methods
    How to find out who "liked" a person on Instagram. Proven Methods

    Everyone who is trying to start the path of a blogger or has already achieved some success in this field, hopes that the content that he shares with readers will not be left without attention. The main indicator of page popularity is “likes”. “Thumbs up” is also put when they want to attract the attention of potential subscribers

  • How to restore a channel on YouTube: detailed instructions, simple and effective tips
    How to restore a channel on YouTube: detailed instructions, simple and effective tips

    This article describes how to restore a channel on YouTube after deleting it. To understand this task, it will be useful to familiarize yourself with some terminology. There is a difference between deleting and blocking a YouTube account

  • How to remove a contact from "Vatsap" and how to block an unwanted interlocutor
    How to remove a contact from "Vatsap" and how to block an unwanted interlocutor

    WhatsApp is a popular messenger. It has many features that users are not even aware of. One of these is the ability to block contacts. It helps to get rid of annoying interlocutors. And how to remove a contact from WhatsApp and how to block it? You can perform these actions in different ways