Logo
HOW TO
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
 
 
Windows Server

Windows Server 2008 Server Core : emoving Files with the Del and Erase Commands, Compressing Files with the Diantz and MakeCab Utilities

11/6/2012 3:46:10 PM

1. Removing Files with the Del and Erase Commands

The Del and Erase commands are functionally equivalent. The two commands started with different versions of DOS, but they perform the same task now: erasing files that you no longer need from the hard drive. Unlike the deletion that Windows performs, the files don't end up in the Recycle Bin; the deletion is permanent. These commands use the following syntax:

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

The following list describes each of the command line arguments.


names

Defines the file or directory names to remove from the hard drive. You can use wildcard characters to specify the filenames. See the "Working with Wildcard Characters" sidebar for details. Deleting a directory also deletes all of the files that the directory contains. Consequently, these commands can be exceptionally destructive.


/A

Deletes files or directories based on their attributes. 

NOTE

Server Core adds the L attribute for reparse points and the I attribute for nonindexed files. The I attribute is a little tricky because you see it when the file isn't indexed versus when it has the required feature such as when you use the other attributes. These new attributes help you work with new file system features.


/F

Forces the deletion of files marked with the read-only attribute. Normally, the commands prompt the user to delete such files.


/P

Prompts the user to delete every file. This command line switch provides a safety factor, but also increases the time required to delete files.


/Q

Deletes files based on a wildcard specification without prompting the user first. Normally, the utilities prompt the user before deleting all of the files in a directory.


/S

Deletes the specified files from all subdirectories. This command comes in handy when you want to remove all of the files with a given name on a hard drive. Windows often creates multiple copies of files; locating them all can be difficult.

Working with Wildcard Characters

You might wonder how you can make your use of commands and utilities even more efficient. Most of these utilities will let you work with multiple files at once, but you need to know the secret of specifying multiple files. Wildcard characters let you specify a group of files or directories without naming each file or directory individually. There are two standard wildcard characters: * and ?. The asterisk (*) specifies any number of characters, while the question mark (?) specifies a single character. You can use the two wildcard characters in combination to create complex file specifications to locate just about any file.

Most people are familiar with the * character. Typing Dir S*.TXT at the command line locates every text file in the current directory that begins with an S. However, you can use the * in any location. For example, typing Dir *S*.TXT at the command line would locate any text file that contains an S in any part of its name. Likewise, typing Dir *S.TXT would locate any text file that contains an S at the end of its name. You can also use the * for the file extension. Typing Dir S.* locates any file with S as a filename, but with any file extension.

The ? is far more selective than the * and many people fail to recognize its value. For example, typing Dir S??.TXT at the command line will locate any text file with three characters in its filename that begins with the letter S. Consequently, this command will locate SUB.TXT and SUN.TXT, but not SUBST.TXT or RUN.TXT (notice that even though RUN.TXT contains three letters, it doesn't begin with an S). Like the *, you can use the ? wildcard character anywhere in the filename. For example, you can type Dir *.EX? to locate both compressed and uncompressed executable files in the current directory. Without the selectiveness of the ? wildcard, you might end up with files that you didn't really want to find.

2. Compressing Files with the Diantz and MakeCab Utilities

Most people assume that you need to use a third-party compression product to create file archives with Windows. Of course, the ZIP file format is the most popular solution, but there are other alternatives, such as the RAR format supported by WinRAR (http://www.rarlab.com/). However, you can use the cabinet (CAB) file format without buying a third-party utility. The only utility provided with newer Windows versions is MakeCAB. An older utility, Diantz, appears on the hard drive, but it calls MakeCAB. The CAB file appears in many places in Windows. For example, you'll find that Microsoft uses CABs to compress many application files on setup disks. In fact, there's even a Microsoft Cabinet Software Development Kit discussed at http://support.microsoft.com/kb/310618/. This utility uses the following syntax:

MAKECAB [/V[n]] [/D var=value ...] [/L dir] source [destination]
MAKECAB [/V[n]] [/D var=value ...] /F directive_file [...]

The following list describes each of the command line arguments.


source

Specifies the name of the file you want to compress. Unlike many Windows utilities, you can't use wildcards to create a file specification. Provide a source filename when you want to compress a single file or a directive file when you want to compress multiple files.


destination

Specifies the name of the destination file. When you specify a source file without a destination filename, the utility creates a file with an underscore that replaces the last letter of the file extensions. For example, when you type MakeCAB NewFile.txt and press Enter, the utility produces an output file with the name NewFile.tx_.


/F
directive_file

Specifies the name of a Diamond Directive File (DDF) that contains instructions for creating complex archives. You can specify multiple files, some of which are compressed and others that aren't. Using a DDF, you can create an archive that spans multiple disks. The MAKECAB.DOC file in the \cabsdk\DOCS directory of the Microsoft Cabinet Software Development Kit tells how to create a DDF.


/D
var=value

Defines variable settings for the MakeCAB utility. These variables control how MakeCAB works. For example, you can tell MakeCAB to create an archive without compressing any of the files by using the COMPRESS=OFF directive. You can find a complete list of variables and their associated values in section "4.2.2. Variable Summary" of the Microsoft Cabinet Software Development Kit.


/L
dir

Specifies the directory to use to store the archive. The default setting uses the current directory.


/V
[n]

Specifies a level of verbosity for the compression messages. The utility accepts any value between 1 and 3. The default setting is 1, which provides major messages and a completion message. The second verbosity level provides a list of files in the archive as the utility compresses them. The third verbosity level includes compression levels and other activities.

Other -----------------
- Windows Server 2008 Server Core : Comparing Two Files with the Comp Utility, Copying Files with the Copy Command
- Microsoft Lync Server 2010 Monitoring : Configuration
- Windows Server 2008 R2 file and print services : Administering File Shares (part 3) - Publishing shared folders to Active Directory
- Windows Server 2008 R2 file and print services : Administering File Shares (part 2) - Securing shared folders
- Windows Server 2008 R2 file and print services : Administering File Shares (part 1) - Creating shared folders
- SQL Server 2008 R2 : A Performance and Tuning Methodology (part 4) - Tools of the Performance and Tuning Trade
- SQL Server 2008 R2 : A Performance and Tuning Methodology (part 3) - Performance and Tuning Design Guidelines
- SQL Server 2008 R2 : A Performance and Tuning Methodology (part 2)
- SQL Server 2008 R2 : A Performance and Tuning Methodology (part 1)
- System Center Configuration Manager 2007 : Making the Status Message System Work for You
 
 
REVIEW
- First look: Apple Watch

- 10 Amazing Tools You Should Be Using with Dropbox

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
 
VIDEO TUTORIAL
- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
 
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS
Popular keywords
HOW TO Swimlane in Visio Visio sort key Pen and Touch Creating groups in Windows Server Raid in Windows Server Exchange 2010 maintenance Exchange server mail enabled groups Debugging Tools Collaborating
Top 10
- Microsoft Excel : How to Use the VLookUp Function
- Fix and Tweak Graphics and Video (part 3) : How to Fix : My Screen Is Sluggish - Adjust Hardware Acceleration
- Fix and Tweak Graphics and Video (part 2) : How to Fix : Text on My Screen Is Too Small
- Fix and Tweak Graphics and Video (part 1) : How to Fix : Adjust the Resolution
- Windows Phone 8 Apps : Camera (part 4) - Adjusting Video Settings, Using the Video Light
- Windows Phone 8 Apps : Camera (part 3) - Using the Front Camera, Activating Video Mode
- Windows Phone 8 Apps : Camera (part 2) - Controlling the Camera’s Flash, Changing the Camera’s Behavior with Lenses
- Windows Phone 8 Apps : Camera (part 1) - Adjusting Photo Settings
- MDT's Client Wizard : Package Properties
- MDT's Client Wizard : Driver Properties
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro