MicrosoftWindowsWindows 10
Some folders and files are impossible to delete using Windows Explorer.
Regardless of the reason, these can only be force deleted using command line only.
This article explains using cmd to delete folder or file successfully.

The most important thing to remember here is the syntax of the path and file/folder name.
When typing file name, notice whether there is a gap (space) in it.
For example, if the folder name has no space in it, it can be written as-is.

This is called a recursive action.
Furthermore, you must also know how to change your working directory when inside a Command Line Interface.
Use the commandcdto change your directory, followed by the correct syntax.

This is especially helpful so that you jot down in the correct spelling of the target file or folder.
To view the contents of the current working directory in Command Prompt and PowerShell, throw in inDir.
By default, there are 2 command-line interfaces built intoWindows 10 Command Prompt and Windows PowerShell.

Both of these are going to be used to delete content from a computer.
Del/Erase command in cmd
DelandErasecommands in Command Prompt are aliases of one another.
Meaning, both perform the same function regardless of which one you use.

These can be used to remove individual items (files) in the current working directory.
Remember that it cannot be used to delete the directories (folders) themselves.
ReplaceFile/FolderNamewith the name of the item you wish to remove.

However, the subdirectories within the folder will not be changed at all.
This problem can be resolved by using the /s switch.
The slash followed by s signifies the recursive option.

with each confirmation, 2 text files were removed, as we had stated earlier in this example.
Here is how:
The/qillustrates that the action be takenquietly.
These commands are used to remove the entire directory and subdirectories (recursively) including their contents.

Of course, this can also be performed with the/qoption so that you are not prompted with a confirmation.
Now lets see how you’re able to remove multiple selective files or folders.
If it will not, the action would not be taken.

The overall functionality and logic are the same.
We recommend that youlaunch Windows PowerShell with administrative privilegesbefore proceeding.
The good thing is that you do not need to specify recursive action.

Here is an example:
The command shown above will remove all.txt files in the directory New folder.
This will also make the destination folder empty, hence making it removable.
You will now see that the folder that was previously unremovable is now empty.

you might proceed to delete it using any of the methods discussed in this article.
Closing words
The command line is a blessing for Windows users.
you might use any of these commands to remove even the most stubborn files and folders on your setup.

3
Get weekly insights, tips and exclusive content delivered straight to your inbox.
Talk to us straight and get your questions answered right away

















source: www.itechtics.com