cmd del command file deletion
Updated: July 5, 2009 14:15:05 Author:
The command used to delete a file is del, and its full name is delete.
The usage of the del command is very simple, just use the "del file path" format. For example, if you want to delete the root directory of the D disk, just use del d:\.
However, not all files can be handled with just the del command, such as files with hidden attributes, read-only attributes or system attributes. If d:\ has hidden attributes, if it is just del d:\, d:\ will remain unmoved. How to delete it? At this time, you need to add some auxiliary parameters to the del. The hidden attribute is hidden, use del /a:h, read-only attribute is read, use del /a:r, system attribute is system, use del /a:s, if you don't know what attributes the file is, then use del /a - but there is an exception. When the file has read-only attributes, you have to add the del /a /f parameter. Therefore, if you want to force delete a file that does not know the attributes, using the del /a /f statement is the safest way. Here, the /f parameter means force deletion of read-only attribute files. f is taken from foce, which means force.
For a while, the Viking virus raged the Internet and destroyed many files with a destruction. The most important point is that a file was generated in each directory. As long as these files were deleted, the virus would be no longer harmful. To delete files in each directory, it will be annoying if you click on the subfolders to delete them. If you use the del command, a simple statement can be done, that is: execute the del /a /f /s command in the specified directory. Here, /s means searching all subfolders in the current directory and deleting the specified file. S is taken from sub, indicating the meaning of "sub-directory" and "sub-directory".
Deleting files is a very dangerous thing. If you are not careful, you may delete important files. Therefore, you need to be careful when performing the deletion operation. If you need to confirm before deletion, you can add a parameter: /p.
Of course, for very confident deletion operations, there is no need to confirm one by one. You can choose the silent deletion mode. At this time, you need to use the parameter: /q, which is the abbreviation of quiet.
However, not all files can be handled with just the del command, such as files with hidden attributes, read-only attributes or system attributes. If d:\ has hidden attributes, if it is just del d:\, d:\ will remain unmoved. How to delete it? At this time, you need to add some auxiliary parameters to the del. The hidden attribute is hidden, use del /a:h, read-only attribute is read, use del /a:r, system attribute is system, use del /a:s, if you don't know what attributes the file is, then use del /a - but there is an exception. When the file has read-only attributes, you have to add the del /a /f parameter. Therefore, if you want to force delete a file that does not know the attributes, using the del /a /f statement is the safest way. Here, the /f parameter means force deletion of read-only attribute files. f is taken from foce, which means force.
For a while, the Viking virus raged the Internet and destroyed many files with a destruction. The most important point is that a file was generated in each directory. As long as these files were deleted, the virus would be no longer harmful. To delete files in each directory, it will be annoying if you click on the subfolders to delete them. If you use the del command, a simple statement can be done, that is: execute the del /a /f /s command in the specified directory. Here, /s means searching all subfolders in the current directory and deleting the specified file. S is taken from sub, indicating the meaning of "sub-directory" and "sub-directory".
Deleting files is a very dangerous thing. If you are not careful, you may delete important files. Therefore, you need to be careful when performing the deletion operation. If you need to confirm before deletion, you can add a parameter: /p.
Of course, for very confident deletion operations, there is no need to confirm one by one. You can choose the silent deletion mode. At this time, you need to use the parameter: /q, which is the abbreviation of quiet.
Related Articles
BAT batch processing implements string interception function
This article mainly introduces the BAT batch processing to implement string interception function. This article directly gives multiple interception examples to teach you how to implement string interception. Friends who need it can refer to it.2015-06-06Commands to use system paths in batch processing
System paths refer to some paths that start with %SystemRoot% (represented by "%name%"). Its function is to tell the system that the file (folder) I want to locate is in the Windows directory of the system partition.2008-07-07Run cmd to directly enter the specified directory
Create a new .bat batch file, the file command is @ECHO OFF cmd /k cd /d c:\data Run the batch file cmd to enter the specified folder. Interested friends can refer to it2013-04-04Code for recursively deleting directories in dos
This article mainly introduces the code of recursively deleting directories in Dos. Friends who need it can refer to it2014-05-05Find the latest batch bat file
Find the latest batch bat file...2007-08-08Register batch files as service automatically when the system starts
How to register a batch file as a service, and automatically call the script when the system starts. The following is the specific implementation process. Friends who need it can refer to it.2014-04-04Detailed explanation of batch file syntax
This article mainly introduces the grammar of batch processing. Batch processing has a very distinctive feature: it is easy to use, flexible, powerful, and has a high degree of automation. Friends who need it can refer to it.2022-09-09Win2003 command to kill any process (taskkill,ntsd)
Only then can you close a process that cannot be shut down with the task manager? Most people think of specialized tools, such as IceSword. In fact, using the tools that come with Windows can kill most processes2011-10-10A little trick ntlm
A little trick ntlm...2006-09-09Solution to Chinese garbled code in cmd mode (registration form)
Fault description Chinese garbled code in cmd mode. When the customer runs the operating software, he needs to modify cmd. If he finds cmd code, the customer is unwilling to rework the system.2012-07-07