Erase Command In Windows Server 2008

In this article, I will explain how the Erase command can be used in Windows server 2008.
  • 2093

Introduction

Erase command is command-line tool that is built in Windows Server 2008 and is available in all version of Windows. Erase command is the same as del command. Erase command is used to delete one or more files from disk. You can use wildcard characters (? and *) to delete more than one file at a time. Basic syntax for using Erase command given below.

 Syntax

del [/p] [/f] [/s] [/q] [/a[:]<Attributes>] <Names>
erase [/p] [/f] [/s] [/q] [/a[:]<Attributes>] <Names>

In above syntax

Parameter Description
/p Prompts you to enter Y or N for confirmation before deleting specified file.
/f Forces deletion of read-only files.
/s Delete specified files from the current directory and all subdirectories.
/q Quiet mode. Do not prompts you for confirmation before deleting specified files. 
/a: Deletes files based on file attributes.
<Attributes> Specifies following file attributes: Read-only files (r), Archive files (a),  System files (s) and Hidden files (h)

Note: Without parameter, program will delete the files from current drive or directory.

Example

To erase all the files in current directory.

erase *.*

If you use this type (deleting all files ) of command, del command displays the following prompt

Are you sure (Y/N)?   
If you are sure you are deleting the files you want to delete, press Y and then press ENTER . To cancel, press Y and then press ENTER.

Ask Your Question

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.