
Rmdir (rd)
Удаляет каталог.
Параметры
- [диск:]путь
- Задает диск и местоположение каталога для удаления.
- /s
- Удаляет указанный каталог и все подкаталоги вместе с файлами. Параметр /s
используется для удаления дерева каталогов. - /q
- Запускает rmdir в скрытом режиме. Команда удаляет каталоги без запроса
подтверждения. - /?
- Отображает справку в командной строке.
Примеры
На экране должны быть выведены только символы «.» и «..».
Для вопросов, обсуждений, замечаний, предложений и т. п. можете использовать
раздел форума
этого сайта (требуется регистрация).
In this article, we will elaborate on several methods to delete folders or files recursively on windows. The content of this post is provided below:
- Using Command Prompt
- Using PowerShell
So, let’s start!
Command Prompt (CMD) offers a variety of commands to perform any operation on windows. The “rd” and “rmdir” commands can be used to delete files or folders recursively. Here, we will use the above-mentioned commands to perform the recursive deletion of files/folders.
Using rd Command
To remove files or folders on Windows recursively utilize the “rd” command. Here, the “/s” option will delete the folders and all files recursively, and the “/q” option will prevent asking for confirmation:

The successful execution of command indicates that the folder has been deleted successfully.
Using rmdir Command
We can use the “rmdir” command to delete folders or files in Command Prompt. Similarly, “/s” is used to remove subfolders and files recursively:

To remove a folder by specifying the folder name, utilize the provided command. The “if” condition is applied to check whether the folder exists or not:
exist C program sq C program

How to Delete Files or Folders Recursively on Windows Using PowerShell?
- Using “Remove-Item” cmdlet
- Using “rm” command
- Using Delete() method
Let’s examine each of the above-mentioned commands.
Using Remove-Item Cmdlet
The “Remove-Item” command is primarily used to remove folders or files. Firstly, use the “cd” command to open the directory:

Next, utilize the “Remove-Item” command with the “-Recurse” option to delete files or folders recursively.
Use the “-Force” option for forceful deletion of the folder if it contains any hidden file:
Remove-Item

Using Get-ChildItem with Remove-Item cmdlet
The “Get-ChildItem” command is used to retrieve the file or folder from the specified path. Here, we have used the “Get-ChildItem” cmdlet to retrieve the content of the folder and then the content is piped with the “Remove-Item” cmdlet to remove the retrieved content.

The above-given output indicates that we have successfully deleted the specified folder.
Using the rm Command
To remove files and folders, use the “rm” command. The “-r” option is used to delete the folder recursively, and the “-fo” option represents the “-Force“:

Using the Delete() Method
Access the target folder using the “Get-ChildItem” command and then use the “Delete()” method to delete all of its files and folders inside that folder:
Get-ChildItem E:\Cprogram.Delete

We have compiled the different commands of Command Prompt and PowerShell to delete folders or files recursively on Windows.
Conclusion
To delete files or folders recursively, you can utilize Windows Command Prompt or Windows PowerShell. In the Command Prompt, use “rmdir” or “rd” commands with the “/s” option is used to remove folders recursively. In PowerShell, the “Remove-Item” cmdlet, “rm” command, and “Delete()” method can be used to delete a folder or file recursively. We have demonstrated all the commands with the help of suitable examples to delete a folder or file recursively on windows.
About the author
I am graduated in computer science. I am a junior technical author here and passionate about Programming and learning new technologies. I have worked in JAVA, HTML 5, CSS3, Bootstrap, and PHP.
DEL (ERASE)
Формат командной строки:
имена – Имена одного или нескольких файлов. Для удаления сразу нескольких файлов используются подстановочные знаки. Если указан каталог, из него будут удалены все файлы.
/P – Запрос на подтверждение перед удалением каждого файла.
/F – Принудительное удаление файлов, доступных только для чтения.
/S – Удаление указанных файлов из всех подкаталогов.
/Q – Отключение запроса на подтверждение при удалении файлов.
/A – Отбор файлов для удаления по атрибутам.
S – Системные файлы
R – Доступные только для чтения
H – Скрытые файлы
A – Файлы для архивирования
Префикс “-” имеет значение НЕ – например -H – не скрытый файл.
erase D:\myfile.txt – удалить файл D:\myfile.txt
erase D:\ – удалить все файлы в корневом каталоге диска D:
erase D:\*.bak – удалить все файлы с расширением .bak
в корневом каталоге диска D:
erase D:\files – удалить все файлы в каталоге files диска D: – будут удалены
все файлы, не имеющие хотя бы один из атрибутов скрытый (H) , системный (S) и
только чтение ( R )
del /A:h d:\files\*.htm – удалить все файлы с расширением htm и атрибутом
скрытый в каталоге D:\files . Файлы, не имеющие атрибута скрытый или
имеющие, дополнительно к нему, другие атрибуты, удаляться не будут.
del /A:hsra d:\files\* – удалить все файлы с установленным набором атрибутов H , S, R, A
del d:\files\?d?.* – удалить файлы, имеющие в имени символ d и любое расширение.
del /S /F /Q %TEMP%\*.tmp – очистка каталога временных файлов.
Будут удалены все временные файлы с расширением .tmp в каталоге
для временных файлов и всех его подкаталогах без запроса на подтверждение
удаления.
Весь список команд CMD Windows
Командная строка – мощный инструмент для автоматизации и упрощения многих задач, которые возникают при администрировании компьютера с операционной системой Windows. В этой статье мы рассмотрим команды DEL, ERASE, RD и RMDIR. С их помощью вы сможете удалять файлы и папки прямо из командной строки.
Удаление файлов через командную строку
Если вам нужно удалить файл через командную строку, то для этого нужно использовать команду или . Эти команды являются синонимами и работают одинаково. Вы можете получить подробную информацию об этих командах, если введете их в командную строку с параметром «». Например, вы можете ввести «» и в консоль выведется вся основная информация о команде .
Команда (или ) предназначена для удаления одного или нескольких файлов и может принимать следующие параметры:
- – удаление с запросом подтверждения для каждого файла;
- – удаление файлов с атрибутом «только для чтения»;
- – удаление указанного файла из всех вложенных папок;
- – удаление без запроса на подтверждение ;
– удаление файлов согласно их атрибутам;
- — Системные;
- — Скрытые;
- – Только для чтения;
- — Для архивирования
- Также перед атрибутами можно использовать знак минус «-», который имеет значение «НЕ». Например, «-S» означает не системный файл.
Обычно, для того чтобы воспользоваться командной нужно сначала перейти в папку, в которой находится файл для удаления, и после этого выполнить команду. Для того чтобы сменить диск нужно просто ввести букву диска и двоеточие. А для перемещения по папкам нужно использовать команду «».

После того как вы попали в нужную папку можно приступать к удалению файлов. Для этого просто введите команду и название файла.
del test.txt

Также, при необходимости вы можете удалять файлы, не перемещаясь по папкам. В этом случае нужно указывать полный путь к документу.
del e:\tmp\test.txt

Если есть необходимость выполнить запрос на подтверждение удаления каждого из файлов, то к команде нужно добавить параметр «». В этом случае в командной строке будет появляться запрос на удаление файла и пользователю нужно будет ввести букву «Y» для подтверждения.
del /p test.txt

Нужно отметить, что при использовании параметра «», отвечающие за атрибуты буквы нужно вводить через двоеточие. Например, для того чтобы удалить все файлы с атрибутом «только для чтения» и с расширением «» нужно ввести:
del /F /A:R *.txt

Аналогичным образом к команде DEL можно добавлять и другие параметры. Комбинируя их вы сможете создавать очень мощные команды для удаления файлов через командную строку Windows. Ниже мы приводим еще несколько примеров.
Уничтожение всех файлов в корне диска D:
del D:\
Уничтожение всех файлов с расширением «» в корне диска :
del D:\*.txt
Уничтожение всех файлов в папке (документы с атрибутами будут пропущены):
del D:\doc
Уничтожение всех файлов с атрибутом «только для чтения» и расширением «» в папке :
del /A:r d:\doc\*.txt
Удаление папок через командную строку
Если вам нужно удалить папку через командную строку Windows, то указанные выше команды вам не помогут. Для удаления папок существует отдельная команда или (сокращение от английского Remove Directory).
Команды и являются синонимами и предназначены для удаления папок. Они могу принимать следующие параметры:
- — удаление всего дерева каталогов, при использовании данного параметра будет удалена не только сама папка, но и все ее содержимое;
- – удаление дерева папок без запроса на подтверждение;
Например, для того чтобы удалить папку достаточно ввести команду RD и название папки. Например:
rd MyFolder

Если папка содержит вложенные папки или файлы, то при ее удалении будет выведена ошибка «Папка не пуста».

Для решения этой проблемы к команде нужно добавить параметр «». В этом случае удаление проходит без проблем, но появляется запрос на подтверждение удаления. Например:
rd /s MyFolder

Для того чтобы удаление дерева папок прошло без появления запроса на подтверждение к команде нужно добавить параметр «». В этом случае папка удаляется без лишних вопросов. Например:
rd /s /q MyFolder

Также команда может принимать сразу несколько папок, для этого их нужно просто разделить пробелом. Например, чтобы сразу удалить
rd Folder1 Folder2

Если же вам нужно удалить через командную строку папку, которая сама содержит пробел, то в этом случае ее название нужно взять в двойные кавычки. Например:
rd "My Files"

Комбинируя команды и , можно создавать мощные скрипты для очистки и удаления папок в операционной системе Windows.
Удаление файлов и папок в PowerShell
В консоли PowerShell вы можете использовать рассмотренные выше команды и , либо «» — собственную команду (командлет) PowerShell. С помощью данной команды можно удалять можно удалять файлы, папки, ключи реестра, переменные и другие объекты.
Например, для того чтобы удалить файл или папку в консоли PowerShell можно использовать команду:
Remove-item file.txt Remove-item MyFolder

Создатель сайта comp-security.net, автор более 2000 статей о ремонте компьютеров, работе с программами, настройке операционных систем.
Задайте вопрос в комментариях под статьей или на странице
«Задать вопрос»
и вы обязательно получите ответ.
Команда RMDIR используется для удаления каталогов в операционной системе Windows через командную строку. У команды RMDIR также есть синоним RD.
Синтаксис команды выглядит следующим образом:
Команда имеет следующие параметры:
/S — удаление дерева каталогов, т.е. будет удалён не только указанный каталог, но и все содержащиеся в нём файлы и подкаталоги;
/Q — отключение запроса на подтверждение действия при удалении дерева каталогов с помощью ключа .
Примеры использования команды :
Удаление папки C:\Primer:
Обратите внимание, что в этом примере не задан параметр . Это значит, что удаляемая папка должна быть пустой.
Удаление папки C:\Primer и всех её подпапок:
rmdir /s C:\PrimerУдаление папки C:\Primer и всех её подпапок без запроса на подтверждение:
rd /s /q C:\PrimerКоманда () позволяет одновременно указать несколько каталогов. Но вот шаблоны имён файлов и папок не поддерживаются. Например, если указать путь C:\Primer\*.*, то попытка выполнения команды завершится сообщением об ошибке.
Удаление двух каталогов:
rmdir C:\Primer C:\Primer2Если нужно очистить каталог, но не удалить его, можно сначала сделать его текущим, после чего запустить команду ():
cd "C:\Primer Folder"
rd /s /q "C:\Primer Folder"Если имя каталога содержит пробел, его нужно заключить в кавычки.
<!– Put this script tag to the of your page –>
Команда RMDIR (RD) – удалить каталог файловой системы Windows.
RMDIR
RD
Формат командной строки:
/S – Удаление дерева каталогов, т. е. не только указанного каталога, но и всех содержащихся в нем файлов и подкаталогов.
/Q – Отключение запроса подтверждения при удалении дерева каталогов с помощью ключа /S.
Примеры использования команды RD ( RMDIR)
RD C:\Mydocs C:\Myprogs – выполнить удаление содержимого папок C:\Mydocs и C:\Myprogs.
RD C:\docs – выполнить удаление папки C:\docs. Если параметр /S не задан, то удаляемая папка C:\docs должна быть пустой.
RD /S /Q C:\Docs – удаление папки C:\Docs и всех ее подпапок без запроса на подтверждение.
Особенность реализации команды RD с параметром /S заключается в том, что будут удалены не только подкаталоги, но и сам каталог C:\Docs, даже если в нем существовали файлы, а не подпапки. Поэтому, для
удаления только содержимого каталога ( когда требуется сделать каталог пустым, а не удалить его совсем), можно воспользоваться следующим приемом – сделать
удаляемый каталог текущим и выполнить команду RD по отношению к его содержимому:
CD “My Folder”
RD /s/q “My Folder”
/S
Ниже приведенный командный файл удаляет пустые папки в каталоге временных файлов,
определяемом значением переменной окружения TEMP. Список удаленных папок записывается в файл с именем c:\tempfoldersempty.txt
FOR /D %%i in (*) do (
Весь список команд CMD Windows
On Windows 11, you can use the del command with the terminal to quickly delete a file or folder. However, you can’t use it to delete folders recursively since the tool is designed for files.
If you have to remove files and subfolders from a folder, you must use different tools. For example, you can use the rmdir (remove directory) a tool with Command Prompt to delete folders recursively, or you can use the Remove-Item cmdlet on PowerShell.
This guide will teach you two ways to quickly delete folders with Command Prompt and PowerShell subfolders.
Delete folders with subfolders with Command Prompt
To remove a subfolder from a folder with commands on Windows 11, use these steps:
Open Start on Windows 11.
rmdir PATH\TO\FOLDER-NAME
In the command, replace PATH\TO\FOLDER-NAME with the folder path and the folder name to delete. This example removes the “files” folder:
rmdir C:\files

rmdir /s PATH\TO\FOLDER-NAME
This example removes the “files” folder, subfolders, and files:
rmdir /s C:\files

rmdir /s /q PATH\TO\FOLDER-NAME
This example removes the “files” folder, subfolders, and files without prompting for confirmation:
rmdir /s /q C:\files

Once you complete the steps, the command will remove a subfolder from a folder and files from Windows 11.
The /s option deletes the folder and its content in the above command, but it prompts confirmation. The /q option ignores the prompt and deletes the folder recursively.
Delete folders with subfolders on PowerShell
To recursively delete an entire folder (with subfolders) on PowerShell, use these steps:
Remove-Item PATH\TO\FOLDER-NAME
In the command, replace PATHTOFOLDER-NAME with the folder path and the folder name to delete. This example removes the “files” folder:
Remove-Item C:\files

Remove-Item -Recurse -Force PATH\TO\FOLDER-NAME
This example removes the “files” folder:
Remove-Item -Recurse -Force C:\files

After you complete the steps, the command will remove the folder and its contents with or without a prompt, depending on the command.
The -Recurse option deletes the folder and its contents without prompt confirmation. The -Force option erases special items, including read-only or hidden files, but it’s not required.
We may earn commission for purchases using our links to help keep offering the free content. Privacy policy info.
All content on this site is provided with no warranties, express or implied. Use any information at your own risk. Always backup of your device and files before making any changes. Privacy policy info.

Del (erase)
Удаление заданных файлов.
Параметры
- [диск:][путь] имя_файла
- Задание расположения и имени файла для удаления. Параметр имя_файла является
обязательным. Допускается использование нескольких имен файлов. Имена файлов следует
разделять пробелом, запятой или точкой с запятой. - /p
- Задание удаления с подтверждением для каждого файла.
- /f
- Задание удаления файлов с атрибутом «Только чтение».
- /s
- Удаление заданных файлов в каталоге и всех его подкаталогах. Выводит имена удаляемых файлов.
- /q
- Задание автоматического режима. Не выводится подтверждение на удаление.
- /a
- Удаление файлов с заданными атрибутами.
- атрибуты
- Задание следующих атрибутов файла
- /?
- Отображение справки в командной строке.
Примеры
Чтобы удалить все файлы из папки Test на диске C, введите одну из следующих команд:
del c:\test
del c:\test\*.*
Для вопросов, обсуждений, замечаний, предложений и т. п. можете использовать
раздел форума
этого сайта (требуется регистрация).
Delete/Select files based on a date which utilizes MM and/or DD for file naming patterns.
/M Specifies the pattern being used is based on months.
/D Specifies the pattern being used is based on days.
The number of months (/M) or days (/D) to keep, including the current.
For example, entering 1 keeps only the current month/day and 6 would keep the current minus 5.
Path The root location to search. Subdirectories will be searched.
The file search pattern placed before of the month/day when building the search string.
The file search pattern placed after of the month/day when building the search string.
/L (optional) Lists all files matching the pattern, but does not delete them.
/DEL (optional) Deletes all files matching the pattern.
DeleteByDatePattern /M 3 “%WinDir%\system32\LogFiles” ex?? ??.log /DEL
Deletes all IIS log files (Windows Server 2003) except for the current and previous two months.
DeleteByDatePattern /D 7 “D:\Backup” *-????-??- .zip /DEL
Deletes all zip files from the D:\Backup folder except for the current week.
The file name pattern assumed above is “*-YYYY-MM-DD.zip”
DeleteByDatePattern /M 0 “C:\” *( )* /L
Prints a list of all files on the C drive matching the pattern: “*-MM-*” (where MM is replaced with 01-12)
DeleteByDatePattern /D 14 “C:\Logs” Log-???? .txt
Prints a list of all patterns which would be processed by the script.
Assumes your Windows Date/Time settings are set to ‘DayOfWeek M/D/YYYY’ format.
If your format is different, you will need to alter the variables below so they align.
tokens=1,2,3,4 delims=/
Working off of the previous month’s max days.
Determine the range to be removed.
Process all less than the low range.
Process all greater than the high range.
MS-DOS is a widely used operating system for personal computers.
Creating a directory
Creating a directory is helpful if you want to organize related files into groups to make them easy to find.
1. To create a directory, md command needs to be used. The “md” command stands for “make directory”.
C:\> md fruit
By typing above command, directory named fruit is created at the path which was selected i.e. if C:/> is selected, then fruit directory is created in C drive.
2. If you want to check whether directory is created successfully or not then use dir command to verify.
by typing above command, list of all directoires gets displayed on the screen where you can check whether fruit directory is created successfully or not.
3. If you want to move inside the fruit directory, you need to change directory that is you need to use cd command.
C:\> cd fruit
Similarly, you can create another directory inside fruit directory, you can use above listed commands and verify the creation of directory.
Deleting a directory
1. To delete a directory, you need to use rd command which stands for “remove directory”.
C:\> rd fruit
By typing above command, directory named fruit will get deleted from C drive.
2. If you want to confirm that fruit directory is deleted from C drive, you need to use dir command for confirmation.

You can delete a folder with subfolders and files using commands, but you need to know the correct tool for the job. On Windows 10, when you have to remove a file or folder with a command terminal, the first tool it comes to mind is the del command, but you will quickly find out that it won’t work to delete folders with subfolders recursively because the tool only deals with files.
The tool you need to use will depend on the command console if you want to delete folders with content inside of them. If you use Command Prompt, rmdir (remove directory) is the tool you want to use to delete folders recursively. On the other hand, if you are using PowerShell, Remove-Item is the cmdlet that will do the job.
This guide will teach you two ways to delete subfolders with Command Prompt and PowerShell on Windows 10.
Delete folders with subfolders from Command Prompt
To delete a folder with subfolders with a command on Windows 10, use these steps:
Open Start on Windows 10.
rmdir PATH\TO\FOLDER-NAME
In the command, replace PATH\TO\FOLDER-NAME with the folder path and the folder name you want to delete. This example removes the “files” folder:
rmdir C:\files

rmdir /s PATH\TO\FOLDER-NAME
This example removes the “files” folder, subfolders, and files:
rmdir /s C:\files

rmdir /s /q PATH\TO\FOLDER-NAME
This example removes the “files” folder, subfolders, and files without prompting for confirmation:
rmdir /s /q C:\files

Once you complete the steps, the command will delete the folders with subfolders and files from Windows 10.
The /s option deletes the folder and its content in the above command, but it prompts confirmation. The /q option ignores the prompt and deletes the folder recursively.
Delete folders with subfolders from PowerShell
To recursively delete an entire folder with a PowerShell command on Windows 10, use these steps:
Remove-Item PATH\TO\FOLDER-NAME
In the command, replace PATH\TO\FOLDER-NAME with the folder path and the folder name you want to delete. This example removes the “files” folder:
Remove-Item C:\files

Remove-Item -Recurse -Force PATH\TO\FOLDER-NAME
This example removes the “files” folder:
Remove-Item -Recurse -Force C:\files

After you complete the steps, the command will delete the folder on Windows 10 and its contents with or without a prompt, depending on the command you choose.
The -Recurse option tells the command that you want to delete the folder and its contents without prompt confirmation. The -Force option is not required but allows for erasing special items, including read-only or hidden files.
We may earn commission for purchases using our links to help keep offering the free content. Privacy policy info.
All content on this site is provided with no warranties, express or implied. Use any information at your own risk. Always backup of your device and files before making any changes. Privacy policy info.
Introduction
If you need to copy an entire directory to a new destination in Windows,
you can use xcopy. This guide will show you how to use xcopy
to recursively copy a directory, all of its subdirectories, and
include hidden files. We will also look at how to remove a directory with
rmdir and move a directory with move.
Recursively copy a directory
The command to recursively copy in Windows command prompt is:
xcopy some_source_dir new_destination_dir\ /E/HIt is important to include the trailing slash \ to tell xcopy the destination
is a directory.
The two options are also important:
/E– Copy all subdirectories/H– Copy hidden files too (e.g..git)
You can see more options by running:
xcopy /?Move a directory
To simply move a directory instead of copying it, use the move command.
move some_directory new_directory_nameRemove a directory
To remove a directory and all of its contents, you can use rmdir.
rmdir some_directory /Q/SThe important options are:
/Q– Do not prompt with “Are you sure?”/S– Delete all contents and sub-directories
Conclusion
You should now know how to recursively copy a directory including hidden files
in Windows using xcopy, delete a directory using rmdir, and move a directory
using move.
In this article, We will know about the top 25 MS-DOS commands list with examples in detail. Nowadays it is time for GUI mode but sometimes DOS commands Play a Vital role in solving the issue.

DOS Commands List Descriptions and Examples
Internal DOS Commands list:
CLS is internal Dos Command used to Clean the screen content.
C:\> CLS and press enter.
This is I.D.C used to know the version of O.S. running.
C:\>VER and press enter.
The Volume command is an internal command used to know the volume name & serial number of the disk (Hard Drive, Pen Drive, etc).
C:\>Vol and press enter.
Date is an internal do command used to know and modify system date.
C:\>Date and Press enter.
The current date is 17:10:2020
Enter New Date mm: dd: yyyy and press enter.
Time is an internal do command used to know the system time and to modify also.
C:\>Time and Press enter.
The tree is an internal Command used to see the directory structure in the disk.
C:\>tree and Press enter.
Note:- This command will work on a DOS-based system
MD is an internal do command used to create directory in the disk.
C:\> MD Dir Name and press enter.
c:\>md vijay and press enter.
CD is internal dos command used to change the directory (to insider or come out).
C:\> CD Dirname and press Enter.
C:\> CD Vijay and press enter.
RD is internal DOS command used to remove (delete) empty directory.
C:\>rd directory name and press enter.
C:\>rd abc and press enter.
- Display all the content in one go.
C:\> dir and enter.
- Display all the content of disk page wise.
C:\>dir/p and Enter.
- Display all the content include hidden also, page wise.
C:\>dir/a/p and enter.
- Display all the files of any disk starting with characters.
C:\>dir a * and press enter.
- searching any file/directory in the disk.
C:\>dir file/dir name /s/p/a and press enter.
Copy con is an internal do command used to create the file in the disk.
C:\>copy con file name ,enter and press F6 and enter(one file copy).
Type command is an internal command used to view the content of any file.
C:\> type file name ↲
Del is an Internal DOS command used to delete the files.
- Delete one file.
C:\> Del file name ↤
- Delete all the file on any Directory.
C:\>ABC>del *.* enter.
REN is an internal do command used to change the name of any directory.
C:\> Ren old name new name and press enter.
Move is an internal command used to change the name of any directory.
C:/> move old dir(name) new dir (name) and press enter.
The label is an internal command used to change the volume name of the disk.
C:\> label new name and, Press enter.
REM is an internal Dos command used to not execute any command.
C:\> Rem Command Name and, Press Enter.
Note:- REM command is mainly used inside the autoexce.bat, config.sys, etc.
The path is an internal DOS command used to inform about the location of commands.
C:\>path+location and, Press enter.
Prompt is an internal dos command used to design the appearance of a drive letter.
- Natural prompt
- C:\>prompt $N$G and, press enter.
- Standard Prompt
- C:\> prompt $p$G and press enter.
The copy is an internal DOS command used to copy files from one location to another.
C:\> Copy source Drive\source path\ files name \ Target Drive \Target Path.
C:\> Copy C:\ABC\*.* D:\xyz and, Press enter.
External DOS commands List
CHKDSK is an external dos command used to find the disk info and also solve file linking problem in the disk.
c:\>chkdks and, Press enter.
C:\>chkdsk/f and press enter.
Scandisk is an external dos command and a very common utility to solve a wide range of DISK problems.
C:\>scandisk and, Press enter.
Note:- In general running, Scandisk in a month will increase system performance.
This is an external DOS command and utility used to manage data in the disk. This command will run after the Scandisk. This is also called data management utility.
C:\>defrag and, press enter.
Xcopy is an external Command used to transfer the data from one location to another.
C:\>xcopy source drive\*.*/e \Target Path and, enter.
This is an external Command used to check the printer Port (LPT-Port).
C:\>dir>prn and, and press enter.
DOS commands list in PDF
You can also Read..
2020:Computer Hardware Terms and Descriptions
DOS (Disk Operation System) is a tool which allows you to control the operation of the IBM PC. DOS is software which was written to control hardware. Here is a summary of some essential DOS commands.
Change Drive
X:\> Y: [enter]Change Directory
Use the CHDIR (CD) command to change the directory. For example, to change the directory from C:\Programs\folder to D:\arcade\folder:
C:\Programs\folder> cd D:\arcade\folder [enter]Then, to navigate to digdug, a subdirectory of D:\arcade\folder:
D:\arcade\folder> cd digdug [enter]Likewise, cd .. navigates to the parent directory (i.e., up one level), while cd \ navigates to the root directory (typically the C drive).
Copy Something
To copy a files or directories in DOS, it is necessary to use the copy command. The default drive indicated in the DOS propmpt is of no concern when copying an item. Files or folders may be copied from anywhere to anywhere, regardless of the prompt drive. For example, to copy the file, pacman.exe from the directory D:\arcade to the directory C:\programs (notice that the location indicated for the DOS prompt is different from both the source directory and the copy directory):
C:\different\> copy D:\arcade\pacman.exe C:\programs [enter]Here, we repeat the previous copy command, while simultaneously renaming the file to ms-pacman.exe:
C:\different\> copy D:\arcade\pacman.exe C:\programs\ms-pacman.exe [enter][prompt location]\> copy [source item] [target location][\optional rename] [enter]List Directory Contents
Use the dir (directory) command to list the contents of a directory. File names and their corresponding sizes will be displayed. For example, to list the contents of the C drive:
X:\> dir C: [enter]Similarly, to list the contents of any directory, \any\dir:
X:\> dir C:\any\dir [enter]Likewise, to list the contents of any subdirectory of X (i.e., the current location as indicated in the DOS prompt):
X:\> dir \sub\dir [enter]Here are some more hot dir tips:
list contents of current directory, X
X:\> dir [enter]list contents of current directory in wide format
X:\> dir /w [enter]list contents of current directory in wide format
X:\> dir /w /p [enter]list all .txt files on drive Y
X:\> dir Y:*.txt [enter]list all files with extension beginning with "t"
X:\> dir Y:*.t?? [enter]Erase Something
To delete an item, use the deadly erase command. For example, if you want to delete the file, terminated.jpg, located on the Y drive:
X:\> erase Y:terminated.jpg [enter]To delete a file within the directory indicated in the DOS prompt, no additional directory information is needed:
X:\> erase terminated.jpg [enter]If you would like to erase all of the contents of a directory, say, Y:
X:\> erase Y:*.* [enter]Format Something
X:\> format A: [enter]Create a Directory
To create a new directory, use the mkdir command. For example, to create a directory called rygar within the Y:\arcade directory:
X:\> mkdir Y:\arcade:rygar [enter]This is even easier if you wish to create a directory within the current directory (i.e., the directory listed in the DOS prompt). For example, to create a rygar directory within the Y:\arcade directory while in Y:\arcade:
Y:\arcade> mkdir rygar [enter]Rename Something
To rename an item, use the ren command. For example, to rename the file atari.exe to nintendo.exe:
X:\> ren Y:\arcade\atari.exe nintendo.exe [enter]Reboot the Computer
To reboot the computer while in DOS, use everybody’s favorite command: [ctrl] + [alt] + [del] (control-alt-delete). For example, to reboot your system after making a mess of things, simultaneously press the three keyboard buttons, Ctrl, Alt, and Del.
Remove a Directory
To remove any empty directory, use the rd command. For example, let’s remove the empty directory, rygar, located within the directory, Y:\arcade:
X:\> rd Y:\arcade\rygar [enter]Likewise, to remove rygar when the current directory is the parent directory:
Y:\arcade> rd rygar [enter]Terminate a Command
To stop the execution of a command before it has completed, press [Ctrl] + [Break] (control-break) simultaneously. The somewhat-obscure Break key is typically located near the Scroll Lock and Print Screen keys. Who knew it.
Change the Date
To change the system date simply type “date” and enter the desired date according to the format specified at the prompt.
Change the Time
To change the system time simply type “time” and enter the desired time according to the format specified at the prompt.
Return to Windows
To exit DOS mode and return to Windows, type “windows” at the DOS command prompt.
Exit DOS
To exit DOS, type “exit” at the DOS prompt.
Related resources

About the Author
Jeff Starr = Web Developer. Book Author. Secretly Important.
What is the correct way to do this?
asked Aug 26, 2011 at 11:15
The batch file should look something like this:
del /s /f /q c:\share\*.*
for /f %%f in ('dir /ad /b c:\share\') do rd /s /q c:\share\%%fdel /s /f /q will recursively search through the directory tree deleting any files (even read only files) without prompting for confirmation.
The second line loops through all the sub directories (which should now be empty) and removes them.
Short of deleting the entire folder and recreating it (which I don’t think you want to do due to permissions?) this should be the easiest way to clean the folder out.
answered Aug 26, 2011 at 12:16
4 gold badges37 silver badges56 bronze badges
rmdir /s/q C:\ShareYou get a “Syntax error” because rmdir only accepts complete names, not wildcards. (In cmd.exe, wildcard expansion is left to the individual programs; not all of them do.)
for /d %f in (C:\Share*) do rmdir /s/q "%f"answered Aug 26, 2011 at 12:16
61 gold badges867 silver badges933 bronze badges
Try this in a command prompt:
rd /s/q "C:\Share"
61 gold badges72 silver badges116 bronze badges
answered Nov 17, 2012 at 5:43

Chau Chee YangChau Chee Yang
1 gold badge11 silver badges21 bronze badges
What about ?
rmdir /S /Q "target"
mkdir "targetEDIT: of course this solution applicable only when you can tolerate a momentary folder absence.
answered Aug 7, 2015 at 11:07
for /f "delims=" %%f in ('dir /ad /b c:\share\') do rd /s /q c:\share\%%fThis does not work if the subdirectories contain other directories that contain spaces.
In order to make this work, I needed to quote the final string, like this
for /f "delims=" %%f in ('dir /ad /b c:\share\') do rd /s /q "c:\share\%%f"Apparently, this causes the command to work on the quoted string instead of just the string itself.

answered Nov 13, 2015 at 0:01

rmdir /s /q “path”
answered Sep 16, 2019 at 7:58
I would try this in the folder where all subfolders should be deleted but the root (and files in the root) left as they are:
for /D %v in (*) do rd /s/q %v
for /D matches directories
and rd/s/q deletes each at a time
answered May 31, 2017 at 20:58
Rmdir (rd)
Удаляет каталог.
Параметры
- [диск:]путь
- Задает диск и местоположение каталога для удаления.
- /s
- Удаляет указанный каталог и все подкаталоги вместе с файлами. Параметр /s
используется для удаления дерева каталогов. - /q
- Запускает rmdir в скрытом режиме. Команда удаляет каталоги без запроса
подтверждения. - /?
- Отображает справку в командной строке.
Примеры
На экране должны быть выведены только символы «.» и «..».




