SoFunction
Updated on 2025-04-10

dos file deletion del command

dos file deletion del command

Updated: April 27, 2009 18:24:59 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, the read-only attribute is read, use del /a:r, the 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, and f is taken from force, 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.
  • dos
  • File Delete
  • del

Related Articles

  • In the future, I often need to know the reference of symbols under CMD/DOS, and I happened to find this article

    In the future, I often need to know the reference of the symbols under CMD/DOS, and I happened to find this article...
    2007-10-10
  • Write a bat batch file to start the windows process and delay shutdown code

    A bat batch file that implements startup of Windows processes and delayed closing is used to open IE and close IE. Friends who are learning batch processing can refer to it.
    2010-11-11
  • Automatically clone guest as batch processing for administrators group

    Automatically clone guest as batch processing of administrators group...
    2007-08-08
  • Restore the primary boot partition

    Restore the primary boot partition...
    2006-12-12
  • Batch automatic login QQ summary and related discussions

    When QQ transmits passwords, it first does MD5 encryption and then does BASE64 conversion, so that normal text information can be obtained for network transmission.
    2011-01-01
  • Displays the batch file for network configuration

    Shows the batch file for network configuration...
    2007-08-08
  • Detailed explanation of CMD commands Directory class commands (md, cd, rd, dir, path, tree, deltree)

    This article mainly introduces the detailed explanation of CMD commands. Directory class commands, pay attention to including md, cd, rd Use of several commands, dir, path, tree, and deltree. Friends who need it can refer to it.
    2017-03-03
  • Batch processing code to obtain the network card name (with modification of IP, gateway, DNS script)

    This script is used for the case where the network card has 2, 3, and 4 because the network card has changed its PCI slot.
    2011-03-03
  • Redirection output of cmd command 2>&1 Detailed explanation

    This article mainly introduces the redirection output of cmd command 2>&1. For detailed explanation, friends who need it, please refer to it.
    2020-08-08
  • Bat batch script console output Chinese garbled code problem and solution

    I found that almost all friends who have used batch scripts will encounter the problem of Chinese garbled code. I have also encountered it several times. Today, through this article, I will share with you the problem and solutions for outputting Chinese garbled code on the bat batch script console. Interested friends follow the editor to take a look.
    2023-07-07

Latest Comments