Recommendations will help you completely delete the folder via command line . In the article about, the DEL command was used, which is intended specifically for files. In the case of folders, the RD or RMDIR commands are applicable.

To achieve the goal, . Enter RD /? and quickly familiarize yourself with the features and parameters of the command. Here you will see only 2 parameters:

  1. /s - when using this prefix, the folder will be deleted, as well as all its nested elements. If your directory is not empty, and you have not specified this parameter, then nothing will work for you.
  2. /Q - used when deleting without confirmation.

In general, the design looks like this:

RD or RMDIR /s/q “full folder path”

Note: when applying the design, the directory and its contents will be completely deleted from the computer and you will not find it in the trash. For safety, do backup copy folders.

Deleting a folder with or without confirmation

I created a directory on my computer called “cmd” and copied several objects into it. Then I entered the following command into the command line:

RD /s “c:\cmd”

Then I pressed Enter and the Y key because cmd prompted me to confirm the deletion.

I checked the C drive and found no directory. Next, I created a folder named “delete” and also copied 5 files, but when entering the command, I removed the /s prefix. It turned out like this:

RMDIR “c:\delete”

After pressing Enter, the deletion did not occur, and a message was displayed on the command line that the folder was not empty. Conclusion, without the /s parameter, you can only delete an empty folder, therefore, using it without this prefix is ​​practically useless.

If you are too lazy to enter the confirmation letter (Y or N), then the following construction is for you. The /q prefix was mentioned above; it is what removes the annoying typing of letters (see the screenshot for proof).

As Zhora Kornev from Terminator Three said, “Hacker Magazine is a must read,” and it’s true, it’s probably difficult to find a young user these days who lives on the Internet and has never wondered about hacking something, or at worst, deleting a system file in the command line of your neighbor. Perhaps the most desirable prey for the RuNet is social network In contact with.

Yandex alone contains 61 thousand sites with a pure entry “how to hack VKontakte”! Well, it's just hack territory! But... there are few skilled people to create high-quality websites, and even fewer skilled people to provide worthwhile information, not to mention the fact that most hack manuals are banal copy-paste or rewriting. Causing harm to someone else's system is not so easy, but ruining your own hardware is a trifle. And so, let’s get started, since time is running out for me (special forces in helmets are grazing under the doors), and the user should not be taken by Murziki, I decided to continue writing posts in the “Working with the command line” section, and in this I will do short review del command line utility, which allows you to delete one or a group of files and even programs. I advise you to read an article about the topic.

The first thought that comes to any dirty trickster’s mind is to fucking delete everything. At one time, while sitting in a local area during an informatics lesson, I hacked my neighbor’s entire Windows, he was so upset, he thought he had opened the notepad incorrectly. Watching Hollywood films about evil hackers, you can usually see how a certain Hrundel sticks into a black screen and enters incomprehensible words from the keyboard, and it opens for him full access to the FBI database. Well, as they say, we are worse. And so, we create a smart look, tell our friends to draw the curtains, and launch... the command CMD line(Black screen as not as). Perhaps it is nostalgia and Western films that give the illusion that by means of shell you can kill the enemy computer. But...this is just the tip of the iceberg.

And so, let’s say we, having read secret waste paper, decided to create a virus, but not wanting to study assembly programming at school leaves only one choice - bat creation virus. The essence of the virus will be simple and banal - remove Windows folder and all its files via the command line. Well, let's try...

DEL command line utility

This command contains the following set of parameters:

DEL [drive:] [path]filename]

[drive:] [path]filename - everything is clear here, enters the path to the object that we want to delete, for example a record

Del D:\data.txt- will delete the text file D:data.txt

Team del d:\temp is designed to delete all data stored in the temp directory, but if it contains a subfolder with files, they will not be touched. Additional attributes allow you to control the deletion process:

/P– this attribute will ask for consent to destroy each object stored in the directory

/F– deletes an object, even with the Read-Only attribute

/S– this option will allow you to delete all files via the command line, including data in subdirectories

/Q– disable the display of a request to confirm destruction.

/A[: attributes] – this attribute is good because it allows you to kill only certain objects, for example, those with the following attributes:

R- "Only for reading",

N- "Hidden"

S- "System"

A- "Archival".

The second additional option is to specify a mask of objects to be killed using wildcards: ? (any one character) and * (any number of characters). That is, the entry:

DEL D:\Temp\data*.txt /s/f– will delete through the command line all text files starting with data.

Well, this seems clear, but how to use such meager knowledge for the benefit of the fatherland, so to speak? On one site I came across a rather heated discussion about the creation of batch files; young people vigorously gave examples of their “mega” viruses. And so, using the above command, let's try to write a virus that will supposedly delete the system folder, change the volume label, mock extensions and reboot the computer:

@echo off
label LAMER
assoc.exe=.gif
del %windir%*.* /q/f /s
shutdown -r –f

The first line disables the output of text and commands, the second changes the disk label to Lamer. Team assoc.exe=.gif causes the system to consider all executable files to be images. Next comes deleting files in system folder via the command line. Well, and finally - a forced reboot without confirmation. There are thousands of such examples, and this one is the most lame, and for them to work, you need to take into account a lot of nuances:

  • Common dirty tricks (such as turning off the mouse or keyboard) are immediately stopped by the antivirus program.
  • Register the path to batch file in startup (as a rule, the registry is suitable for these purposes) will not work if the user’s rights are limited.
  • Type account and operating system. You can go into more detail here. Seven initially will not allow the execution of a number of command line utilities - only on condition that the launch is made on behalf of the BUILT-IN ADMINISTRATOR ACCOUNT. If you are the proud owner of “simple” XP, then creating a limited account and then setting up access rights to certain resources will allow you to avoid a number of unpleasant situations: money was stolen from webMoney, a virus is always crawling onto a flash drive, someone deleted a file via the command line passwords and much more.

Actually, this is one of the factors in using a script server to solve administrative and other tasks.

What made me laugh the most was when one of the “gifted” creators of the bat virus complained that his creation did not work in Vista and loudly declared that it was screwed.

On Windows of any version (XP, 7, 8, 10), a problem often arises when a file or folder with a locked file is not deleted. A message pops up that the file is occupied by another process or is open in some program, or you need to ask permission from someone.

There are several ways to delete a file that is not deleted, renamed, or moved. This is done without additional software, using free program Unlocker, from a bootable USB flash drive or LiveCD, or the DeadLock program.

When deleting locked files and folders, be careful, this may be part of operating system. Without them, Windows will stop loading.

Why isn't it deleted?

  • The file is open in another program. Complete everything unnecessary processes and try again. Sometimes restarting the computer helps.
  • Insufficient permissions to delete. For example, this file was created by another user or the computer administrator removed the deletion rights.

Exceptions

The methods described in the article will not always help:

  • pagefile.sys and swapfile.sys - to remove, disable the swap file.
  • hiberfil.sys - deleted when hibernation mode is disabled.
  • If an access denied message appears. You need to become the owner of the file or folder. The easiest way to do this is with the TakeOwnershipPro program.
  • If a message appears asking permission from TrustedInstaller. This is protection against the removal of system components.
  • Windows.old - folder with old version operating system. It is deleted through the “Properties” of the local drive C. On the General tab there is a “Cleanup” button. A window will open in which select “Clear system files" After the analysis is completed, the “Previous” item will appear in the list in this window. Windows installations" Check this box and click OK.

Deleting the file manually

Message: The file is already in use, please close and try again.

If a file doesn't want to be deleted, the error message usually tells you which process has locked it. This could be explorer.exe or any program that has it open. If you close this program, the file will be deleted.

If the file is occupied by the explorer.exe process

  • Before completing the task, open Command Prompt as an administrator. It is located in “Start - All Programs - Accessories”. Right-click on Command Prompt and select Run as Administrator.
  • Remove the explorer.exe task in the task manager and write del full_path/name.extension in the command line.
  • The path does not have to be entered manually. Click right click mouse on the required file with Shift held down - Copy as a path and paste it into the command line via the right-click context menu.
  • Now restart explorer.exe. In the task manager, click "File - New task - explorer.exe".

Use a bootable USB flash drive or disk

If you have a bootable USB flash drive or LiveCD, or Windows recovery, run them and quietly delete the file standard method or via the command line.


Be careful sometimes when entering through boot disk local disks have different letters. To see a list of folders on drive C, type dir c: on the command line.

If you use bootable USB flash drive or Windows installation disk, the console opens at any time after the language selection stage, using the combination Shift keys+F10.

You can also select the system recovery mode, which will be offered before starting the OS installation.

Command for deleting via the console: del full_path_to_the_file.

Using DeadLock

The free DeadLock program allows you to delete a locked file and change the owner. Download from the official website: https://codedead.com/?page_id=822.

Through the File menu you add problematic file to the program. Right-click on it in the list - unlock it (Unlock) and delete it (Remove).


Using Unlocker

The simplest and most popular program, but now even on the official website a warning about unwanted software is displayed. Along with the program there may be some other virus or advertising, so use at your own peril and risk. Try the methods above first. Website: http://www.emptyloop.com/unlocker/.

After installation in context menu a new item will appear, which is called Unlocker. After clicking the button, the program will complete the interfering process and the file will be unlocked.


If you want to delete a folder, first delete all its contents.

Via command line

There was such a case that the file did not want to be deleted in any way. The size was 0 bytes, the name was written in Russian letters (not supported in older versions of MS-DOS), there was a Read-only attribute and an A attribute (only reading and adding content). The command line helped.


That's all for now. If you know simpler and effective ways, write them in the comments. Which method helped you?

Hello everyone Let's talk today about how to delete folders. But not the way everyone else does it, but in a special way - using the command line... So look, you have a small opportunity to become a little cooler in terms of computer knowledge...

Let's first go back a little and find out what the command line is and why there are many commands in it. This means the command line is still an echo of the times when there was DOS. It's such a system, well Windows type in its infancy, there were no windows, there was darkness in the literal sense. And so they used it, entered commands and did something there. Well, how would it all still be preserved, although few people use it.

We will also look at other questions about the command line, I hope that all this will be interesting to you!

Well, I wrote it because I know myself, why should I burden you with some specific terms... This command line can work without Windows at all, which is why it is also available when restoring Windows..

The command line itself is rarely used now, but mostly admins and all sorts of advanced users know how to use it

I have an important note to make to you. This would be my advice to you. Here on the command line you can enter all sorts of commands there, and so on. The main thing here is to pay attention to the path. Just the way. Well, here’s the path, that is, for example, there is a folder somewhere, and you enter the path to it, well, to delete it. So, pay attention, if the path is very large or there are spaces in it, then to avoid mistakes, enclose it in quotation marks. If the path is short, for example:

C:\papka1\papka2\file.txt

Then you don’t need to put it in quotes, but if the path is long and contains spaces, then you need it, for example:

"C:\Program Files (x86)\Fapka papki\fale papki.txt"

And write it like this on the command line, in quotes, then there will be no mistakes. Well, I hope you understand

How to delete a folder via command line?

Deleting a folder on the command line is not at all difficult, I will show you even more, in the end I hope that the command line will become more understandable to you. It has everything you need to learn about all the teams on your own!

Although I’ll be honest, deleting a folder via the command line is not particularly convenient, but I agree that there are situations when it is simply necessary.

I will show using Windows 7 as an example, but in other Windows everything is almost the same, it seems like nothing has changed. Look, squeeze Win buttons+ R and write a command like this:

And click OK:


The command line will open, a black window like this:


Here it is, the command line! Now look, you need to enter a command into this window, then press enter and then the result will be shown. But what command do you need to enter to delete a folder? And here's what:

This seems to stand for remove directory, that is, delete a directory (folder).

This command and the path to the folder need to be entered into this command line. I specially created a test folder on drive C and named it that way - Test. And now, to remove it via the command line, I just need to enter the following command:

Here's what it looks like on the command line itself:


I press enter and this is the result:


If you think that nothing happened, then you are wrong! Look, there is no error in the end, which means that everything went fine and the folder was deleted! I then checked on the disk and yes, the folder was no longer there

So, but there's something else that's interesting. In general, look, there is also such a thing as command keys. These are the keys additional features teams. Well, the rmdir command has switches that allow you to delete a folder with all its subfolders and files without prompting. Regarding requests, I mean that there will be no message saying that you are sure you want to delete, well, I think you understand. Here's what the command to delete a folder with all subfolders and files inside looks like:

rmdir /S /Q C:\Test

Well, only here instead of C:\Test you indicate your folder that needs to be deleted. Do you even know what? Can you type rmdir /? at the command line? and instructions for additional keys will be shown:


But I must admit that these instructions are not always clear to me...

How to delete a file via command line?

The file can also be deleted without problems from the command line, and this is not difficult either, so don't worry

Look, run the command line again, as I already showed above. That is, Win + R and write cmd there and click OK and that’s it, it appears. To delete a file, you need to use a command like:

I just thought, well, del means delete. But no! There is no command like delete, so just enter del!

So, look, I have a created test file Test.txt on the C:\ drive, let's try to delete it using the del command, for this we write something like this on the command line:

Here's what it looks like on the command line:


And here is the result:


Well, here again you may think, well, what’s going on, there’s nothing in the answer! But no guys, there is no response from the team, because there are no errors!

I checked later, and yes, the Test.txt file was no longer on the system disk, so everything went fine!

But again, I also want to tell you about additional keys, the del command also has them, look, to delete without any prompts, you need to add the /Q key:

del /Q C:\Test.txt

You can look at the help of this command if you enter something like del /?, as a result, this is what you will see:


That's it, I think now you know how to delete files using the command line!

I’ve written everything, but I forgot to write something interesting! In short, guys, look, for example, you have a folder C:\Test, and there are a bunch of files in it. Here's how to delete all files in the Test folder, but just text ones? To delete everything text files, you need to indicate that you don’t care about the name of the files being deleted, the main thing is that they are text files! Write like this:

del C:\Test\*.txt

This asterisk means that anyway, damn names, any names will do, the main thing is the file extension, so that everyone who has .txt will be deleted. Well, I hope it's more or less clear

How to uninstall a program via the command line in Windows 7?

Now this is a bit of an interesting thing. I'll show you how to delete programs from the command line, but I'll say right away that I've never deleted them this way. Well, somehow it didn’t come to that, there weren’t such terrible problems with the computer that it was necessary to remove them only using the command line...

But in life, things happen...

So let's try it. To avoid problems when uninstalling programs from the command line, it is better to run it as an administrator. Here's how to do it easily in Windows 7:


That is, it’s clear, yes, write the word command in the line there in Start, then it appears in the results and there you already right-click on it and select Run as administrator! Well, in short, it's not difficult

By the way, to run Windows 10 as an administrator, you need to right-click on the Start icon and select Command Prompt as Administrator. Well, or hold down Win + X and there will also be this item in the menu.

The command line was launched as an administrator, great, now we do this. To enter the other world, where you can remove programs directly from the command line, we write the following command:

We press enter and this world has already opened:


If you see that you also have something like this:

This means that everything worked out for you, you are almost a super-mega-user

Now, to see all installed programs, you need to enter the following command:

product get name

So I entered it and this is what happened:


Guys, I’ll say right away that I entered the command and thought what the hell, what a mistake, I was already starting to get upset - because there was nothing in response. But judging by the fact that HDD puffed, I waited and waited. The conclusion is that you need to wait a little for the entire list of programs to be displayed. It’s big for me, maybe that’s why it takes so long!

Now look, to delete some program and there was no confirmation request, you need to enter the following command:

product where name="HERE_PROGRAM_NAME" call uninstall /nointeractive

In general, as you can see, there’s a problem here - you need to manually write the program, because you can’t copy it from the command line! And the name of the program should be taken from there! Maybe it can be copied somehow, but I don’t know how. I've never uninstalled programs like this

In general, I’ll now try to delete it this way... Let’s take as an example, because its name is short compared to the others and was easy to enter, since it’s in Russian. Basically I enter the following command:

product where name="Browser Manager" call uninstall /nointeractive

In short, here I entered it:


And here is the result:


You see there is something like this:

Method execution successfull

This means that everything was successful! Guys, I don’t know what to tell you, but I managed to remove this Browser Manager, but it still seems to me that this is some kind of unclear method... Well, damn it, how can I remove it via the command line? Well, it happens that when deleting there are still such options, they say, delete settings and all that, these options, it is not known whether they are disabled or enabled during such a deletion? I personally don't know. In short, this is the case, I wrote to you how to do it, it works, I checked it myself, but it’s better to use normal deletion programs through the Programs and Features window (Start menu > Control Panel > Programs and Features).

How to run command prompt as administrator in Windows 7?

I have already shown above how to run the command line as an administrator, but now I will show a more universal method. Well, or more correct. In general, I like this method better, so I recommend it

In general, look, first launch the task manager, right-click on the taskbar and select the following item there:


Then in the manager you click the File menu and select New task there:


And then you indicate there cmd command and click OK:


Well, this way you can definitely launch the command line as an administrator.

How can I change to a different folder on the command line?

This means the command line, how much it can do and how little we know about it..

Well, that's it, thinking out loud. For example, you are working on the command line, how can you go to another folder altogether? Very simple. If you need, for example, to get to the Java folder, which is located in Program Files (x86), then you need to enter the following command:

cd "C:\Program Files (x86)\Java"

Here I pasted this command into the command line:


I pressed enter and this is the result:


That is, you see - everything is simple, hurray, everything will work out for you too!

How to change to another drive on the command line?

For example, you need to switch to another drive on the command line. How to do it right? Actually, I thought that in order to switch to another disk, the cd command would be enough - but it turned out that no, this is not exactly what is needed. It turns out everything is much simpler, well, I launch the command line, this is what it looks like:


Well, that is, as usual system disk C:\, everything is as usual. But now, to go to drive D, you just need to write the drive and two dots, that is, like this:


Then I pressed enter and this is what came out:


Well, as you can see, it all worked, that is, here you just need to write the drive letter and two dots, and that’s it!

Well guys, that’s all, I honestly hope that everything was clear to you here, that this information helped you answer some question. Good luck and good mood!

12.08.2016

You can delete a folder by right-clicking on it and selecting delete in the context menu. But sometimes this method does not help and I cannot delete the folder, so I will describe several ways to delete the folder.

Deleting a folder using the command line

To delete the Windows folder, do the following. Click “Start” - “All Programs” - “Accessories” - “Command Prompt”. A window will appear in which if you add Help and press “Enter”, a list of commands and a description of each command will appear, the RMDIR command is deleting a folder via the command line. To find out how to write the command you need, for example deleting a folder, you need to add Help RMDIR. The system told us how to write a command to delete a folder. RMDIR [drive:]path. I want to delete the remains of the game paradise in the RAI folder and I got this command. RMDIR /S /Q C:\Games\RAI.

Delete a folder via command line

Press “Enter” and the folder will be deleted immediately.

Deleting a folder using the bat file command

So we found out what the command to delete a folder looks like. There are folders that appear again after some time. To remove them, you can create a BAT file on your desktop because this folder, which we do not need, will be deleted when you run the bat file.

How to make a bat file

Right-click on an empty space on the desktop and select “Create” - “Text Document” from the context menu. Let's open this Text Document, which appeared on the desktop. Enter the command RMDIR /S /Q C:\Games\RAI there, where C:\Games\RAI is the path to your folder. The entire path must be in English because bat file does not start if there are words in Russian in the written bat file. Now click “File” - “Save As”. In the window that appears, in the file name line, write 1.bat and click “Save”.


In 1.bat rename the file

An example bat file will appear on your desktop. Now run 1 bat file and bat delete the folder instantly.

Removing the Windows old folder

Some install the system without formatting the disk and they end up with a folder with old Windows system files, usually called this Windows old folder. Many people do not know that the Windows old folder can be deleted. Delete old folder windows, you can use Disk Cleanup in Windows 7. Click “Start” - “All Programs” - “Accessories” - “System Tools” - “Disk Cleanup”. A window will open in which you need to select the drive on which the Windows old folder is located and click “OK”. The disk will be scanned and a window will appear in which we click “Clean up system files.” In this window, check the box for “Previous Windows installations” and click “OK”. A message will appear saying “Are you sure you want to permanently delete these files?” click “Delete files”.

Removing windows old

System files will be deleted from the Windows old folder and now you can simply delete the Windows old folder.

Delete a folder with administrator rights

Sometimes the folder is not deleted and the message “You need permission to perform this operation” appears. In order for the folder to be deleted, you need to allow full access in the folder properties. To do this, do the following. Right-click on the folder and select “Properties” from the context menu. Go to the “Security” tab and click “Advanced”. In the new window, go to the “Owner” tab and click “Change”.


We will change the owner of the folder

The owner window will open in which you need to select your administrator name (but not administrators), check the box “Replace owner of subcontainers and objects” and click “Apply”.


Changing the owner of a folder

In the message that appears, we confirm and become the owner of this object. From the “Owner” tab, go to the “Permissions” tab and click “Change Permissions”. In the window that opens, select the name of your administrator and click “Change”. A window will open in which we put a tick in the “Full access” item and click “OK” this window will close, and in open window check the boxes:
"Add permissions inherited from parent objects."
“Replace all permissions of the child object with permissions inherited from this object” and click “OK”.


Allow full access to the folder

Again a message will appear with which we agree by clicking “OK” and close all windows by clicking “OK”. Now the folder can be deleted.

Deleting a folder in Total Commander

Permanently delete a folder in Total Commander very easy. You need to find the folder you need to delete and click on it with the left mouse button, and then click the delete button at the bottom of Total Commander or press F8 on the keyboard and a message will appear in which we click “Yes” or “Delete”, depending on whether the folder is empty or there is something in it that is.


Search and Delete empty folders in total commander

The folder will be deleted along with all its contents.

Program to force folder deletion

I like the Unlocker folder deletion program.

Install and the program for deleting non-deletable folders will be in the context menu. Right-click on the folder to be deleted and select Unlocker from the context menu. A window will appear in which set the action to “Delete” and click “Unblock all”. The folder will be deleted.