Del command in Windows

The del command deletes one or more files. This command is the same as the eraser command .

For an example of how to use this command, please see the Example below.

Syntax del command

 del [/p] [/f] [/s] [/q] [/a[:]] erase [/p] [/f] [/s] [/q] [/a[:]] 

Parameters

ParametersDescription Specifies a list of one or more files or directories. Wildcards can be used to delete multiple files. If a folder is specified, all files in the folder will be deleted. / p Confirmation prompt before deleting the specified file. / f Force deleting read-only files (read only). / s Delete specific files from the current directory and all subdirectories. Displays the names of files when they are being deleted. / q Specifies the silent mode. You are not prompted to confirm deletion. / a [:] Delete files based on the following file attributes:
r - File read-only
h - File hidden
i - Not content indexed files
s - File system
a - File is ready for archiving
l - Reparse point
- Prefix means 'no' /? Show help at the command prompt.

Note

Careful:

  1. If you use the del command to delete a file from the drive, you cannot do this.
  2. If you use / p, the del command will display the name of a file and send the following message:
 `FileName, Delete (Y/N)?` To confirm the deletion, press Y. To cancel the deletion and display the next file name (that is, if you specified a group of files), press N. To stop the **del** command, press CTRL+C. 
  1. If you have the command extension, / s will display the name of any file that is not found, instead of displaying the name of the file being deleted (ie the behavior is reversed).
  2. If you specify a folder in Names, all files in the folder will be deleted. For example, the following command deletes all files in the Work folder :
 del work 
  1. You can use wildcards ( * and ? ) To delete multiple files at once. However, to avoid deleting files unconsciously, you should be cautious when using wildcards with the del command. For example, if you type the following command:
 del *.* 

The del command will display the following prompt:

 Are you sure (Y/N)? 

To delete all files in the current directory, press Y and then press ENTER. To cancel deleting, press N and then press ENTER.

Note:

  1. Before you can use wildcards with the del command , use the same wildcard with the dir command to list all files that will be deleted.
  2. Del command , with different parameters, is available from Recovery Console.

For example

To delete all files in a folder named Test on drive C , enter one of the following options:

 del c:test del c:test*.* 

To delete all .bat files from the current directory, enter:

 del *.bak 

To delete all read-only files in the current directory, enter:

 del /a:r *.* 

See more:

  1. Compact command in Windows
  2. The convert in Windows command
  3. Comp command in Windows
4 ★ | 1 Vote

May be interested

  • Rd command in WindowsRd command in Windows
    the rd command helps delete a directory
  • Cmd command in WindowsCmd command in Windows
    the cmd command starts a new version of the command interpreter, cmd.exe. if used without parameters, cmd will display copyright information and the version of the operating system.
  • How to use the command history function in Command PromptHow to use the command history function in Command Prompt
    command prompt is an extremely familiar command for anyone using windows operating system. besides, a lot of current software also supports the command line to perform actions on the command prompt window, instead of on the screen.
  • The sfc command in WindowsThe sfc command in Windows
    (applies to windows server (semi-annual channel), windows server 2016, windows server 2012 r2, windows server 2012)
  • Reg command copy in WindowsReg command copy in Windows
    to copy an entry to the location specified on the local pc or the remote computer we will use the reg copy command. to learn more about how to use the reg copy command, you can track the syntax, explain the command parameters and the example tipsmake.com has compiled below.
  • Fc command in WindowsFc command in Windows
    the fc command compares two files or a collection of files and displays the differences between them.
  • The echo command in WindowsThe echo command in Windows
    the echo command displays the message or turns on / off the command repeat feature. if used without parameters, the echo command will display the current echo setting.
  • Xcopy command in WindowsXcopy command in Windows
    the xcopy command is a command prompt command used to copy one or more files or folders from one location to another. with many options and the ability to copy entire directories, the xcopy command is similar to, but much more powerful, than the copy command.
  • The cacls command in WindowsThe cacls command in Windows
    the cacls command displays or modifies an arbitrary access control list (dacl) on the specified file. the command applies to windows server (semi-annual channel), windows server 2016, windows server 2012 r2, windows server 2012.
  • Clean command in WindowsClean command in Windows
    the clean command deletes all partitions or formats the volume from the current drive. the command applies to windows server (semi-annual channel), windows server 2019, windows server 2016, windows server 2012 r2, windows server 2012.