DEL: Deletes one or more files.


 


... The examples for the command "DEL"
... "DEL" Excerpt from Microsoft Windows Help
... Important information, tips for the "DEL" command

The command: "DEL" is on Windows 12, 11, 10, .. , MS Server 2025, 2022, 2019, .. available

The examples for the command "DEL"

The `DEL` command in Windows Command Prompt is used to delete files. Here are some examples with comments: Example 1: Delete a single file:

DEL file.txt

Description: This command deletes the file "file.txt". Example 2: Delete multiple files:

DEL file1.txt file2.txt

Description: Here the files "File1.txt" and "File2.txt" are deleted. Example 3: Delete all TXT files in the current directory:

DEL *.txt

Description: This command deletes all TXT files in the current directory. Example 4: Delete all files and subdirectories (recursive):

DEL /S /Q directory\

Description: This command deletes all files and subdirectories of the specified directory. `/S` stands for "recursive", and `/Q` disables the confirmation prompt. Example 5: Delete all files older than a certain date:

DEL /Q /FOLDER:C:\Path\ /S /D:01-01-2022

Description: Here all files in the "C:\Path\" directory and in all subdirectories older than January 1, 2022 are deleted. `/Q` disables the confirmation prompt, and `/S` stands for "recursive". Example 6: Delete all files with a specific extension:

DEL *.log

Description: This command deletes all LOG files in the current directory. Example 7: Show help:

DEL /?

Description: This command displays help and information about the available options for the `DEL` command. It is important to use the `DEL` command with caution because deleted files usually cannot be recovered without special software. Make sure you delete the correct files, and note that certain options (like `/S` and `/Q`) can have far-reaching effects, especially when used together.

"DEL" Excerpt from Microsoft Windows Help

Microsoft Windows [Version 10.0.19045.3693]
(c) Copyright 1985-2023 Microsoft Corp.

C:\\WINDOWS>

Deletes one or more files.

DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

  names         Specifies a list of one or more files or directories.
                Wildcards may be used to delete multiple files. If a
                directory is specified, all files within the directory
                will be deleted.

  /P            Prompts for confirmation before deleting each file.
  /F            Force deleting of read-only files.
  /S            Delete specified files from all subdirectories.
  /Q            Quiet mode, do not ask if ok to delete on global wildcard
  /A            Selects files to delete based on attributes
  attributes    R  Read-only files            S  System files
                H  Hidden files               A  Files ready for archiving
                -  Prefix meaning not

If Command Extensions are enabled DEL and ERASE change as follows:

The display semantics of the /S switch are reversed in that it shows
you only the files that are deleted, not the ones it could not find.

Important information, tips for the "DEL" command

There are a few important points to note when using the `DEL` command in the Windows Command Prompt: 1. Irrevocability: The `DEL` command deletes files irrevocably. There is usually no built-in way to recover deleted files from the Recycle Bin. Make sure you are sure which files you want to delete. 2. Permissions: Make sure you have the necessary permissions to delete the selected files. Some system files or protected files require administrator rights. 3. Wildcards: When using wildcards (, ?) to delete files, be extra careful to avoid accidental deletion. For example, `DEL *.` could delete all files in the current directory. 4. Confirmations: The `DEL` command may ask for confirmation if you try to delete multiple files at once. You can disable verification using the `/Q` option.

    DEL /Q file.txt
    
5. Recursive Deletes: If you use the `/S` command for recursive delete, it could delete all files in a directory and its subdirectories. Make sure this is intentional to avoid data loss.

    DEL /S /Q directory\
    
6. Protected System Files: The `DEL` command may have difficulty deleting protected system files. In some cases, additional permissions or running Command Prompt as administrator are required. 7. Delete files older than a specific date: When using the `/D` option in conjunction with the `/S` parameter to delete files older than a specific date, make sure you use the date format correctly stated.

    DEL /S /D:01-01-2022
    
8. Batch scripts: When using `DEL` in a batch script, check the return value (`%ERRORLEVEL%`) to see if the deletion was successful.

    IF %ERRORLEVEL% EQU 0 (
        ECHO deletion successful.
    ) ELSE (
        ECHO Error deleting.
    )
    
9. Show Help: You can use `DEL /?` to display help and information about the available options for the `DEL` command. Therefore, use the `DEL` command with caution and make sure you are aware of its implications, especially when working with wildcards, recursive deletion or deleting system files.


Deutsch
English
Español
Français
Italiano
日本語 (Nihongo)
한국어 (Hangugeo)
汉语 (Hànyǔ)
Türkçe
Português
Português
Svenska
Norsk
Dansk
Suomi
Nederlands
Polski









Windows-10


... Windows 10 FAQ
... Windows 10 How To


Windows 10 How To


... Windows 11 How To
... Windows 10 FAQ



The command DEL - Deletes one or more files.

HTTP: ... console60.000000ko0.000000index.htm/en/020.htm
0.077
11802
Hyper-V PowerShell auf MS Windows Desktop und Server aktivieren!
Zeitzone über PowerShell Befehlszeilen?
Windows 10 Bildschirmtastatur kann nicht gestartet werden?
Print multiple pictures on one page, Windows 10, 11, ..?
The screen goes off too fast and on the Windows 10/11 PC, why?
Activate tabs in Quad Explorer on Windows!
Wo finde und starte ich das PowerShell in Windows 11 und 10?
Transparent glass (Aero) mouse balls for Windows!  
Well suited as a cheap PowerPoint pointer?
Die Aufgabenplanung in Windows 10 und 11 finden!



(0)