Compact Command In Windows Server 2008

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

Introduction

Compact command is Windows Server 2008 command line tool. This command is available in Window 7,Windows Server 2008, Windows Vista, Windows XP and Windows 2000. Compact command allows us to compress or uncompress the files on NTFS partitions. Using this command you can display or change the compression of files or directories on NTFS file system.

Syntax

compact [/c | /u] [/s[:<Dir>]] [/a] [/i] [/f] [/q] [<File Name>[...]]

Parameters of Compact command

Parameter Description
/c Compresses the given directory or a file.
/u Decompresses the given directory or a file.
/s[:<Dir>] Applies compact command to all directories and sub directories or of the current director if none is specified.
/a Displays files with hidden and system attributes.
/i Continues performing operations even after errors have occur.
/f Forces compress or uncompress operations on given files, even those files that was partly compressed when the operation was interrupted by a system crash.
/q Reports only the most essential information.
<File Name> Specifies the file or directory. You can use wildcard characters(* and ?) to specify multiple files.

Note: If above syntax  is used without parameter, compact displays the compression state of the current directory and subdirectories.

Examples

1. Check the compression status of file.

compact filename

2. To set the compression state of files and subdirectories within the current directory, without change the compression state of the current directory.

compact /c /s *.*

Ask Your Question

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

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.