IT tutorials
 
Windows
 

Windows Server 2008 : Compressing Files with compact, Encrypting Files with cipher

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
6/19/2013 2:46:14 AM

1. Compressing Files with compact

The compact command compresses and uncompress files and folders on NTFS drives. The two primary switches you’ll use are /c to compress files and /u to uncompress them. When files are compressed, Windows Explorer displays them with blue text. The following table shows some examples using the compact command.

compact CommandDescription
c:\data>compact
Listing c:\Data\
 New files added to this directory will
not be compressed.
    3617 : 3617 = 1.0 to 1   70-640.rtf
    1641 : 1641 = 1.0 to 1   70-642.rtf
    2629 : 2629 = 1.0 to 1   70-647.rtf
Of 3 files within 1 directories
0 are compressed and 4 are not compressed.
7887 total bytes of data are stored in
7887 bytes.
The compression ratio is 1.0 to 1.

If you enter the command without switches, it shows you the size and current state of compression for files in the current folder.

The output shows the actual size of the files in bytes and the compression ratio. A compression ratio of 1.0 to 1 indicates the file is not compressed.

This also shows the uncompressed size and the actual amount of space taken by the files. Compressed files usually take less space on the disk than uncompressed files.
c:\data>compact /c test.txt

You compress an individual file by using the /c switch and then including the name of the file.
c:\data>compact /c

If you want to compress all files in the current folder, you can use the /c switch by itself. This also changes the folder attribute to compressed, causing new files added to the folder to be compressed.
c:\data>compact /c /s

You can add the /s switch to include subfolders. New files added to any of the folders are compressed.
c:\data>compact /u /s

The /u switch uncompresses files. This example uncompresses all files in the folder and subfolders. New files added to any of the folders are not compressed.
c:\data>compact /c /f test.txt

You can use the /f switch to force compression on the file. This is useful if the original attempt to compress the file is interrupted, leaving the file in a partially compressed state.

2. Encrypting Files with cipher

You can encrypt files on NTFS using the cipher command. These files are encrypted using the Encrypting File System (EFS) feature of NTFS. The two primary switches you use are /e to encrypt files and /d to decrypt them. When files are encrypted, Windows Explorer displays them with green text.

Note

Files can be compressed or encrypted, however, they cannot be compressed and encrypted.


cipher CommandsComments
c:\data>cipher
Listing c:\data\study\Server2008\
New files added to this directory
will not be encrypted.
E 70-640.rtf
U 70-642.rtf
U 70-647.rtf

If you enter cipher without any switches, it shows the current state of the encryption attribute.

Encrypted files are shown with E.

The U attribute indicates the files are not encrypted.

cipher /c provides the same output.
/e
c:\data>cipher /e

The /e switch used by itself encrypts all the files in the current folder and changes the folder attribute to Encrypted. New files added to the folder are encrypted.
/e file
c:\data>cipher /e 70-642.rtf

You can add a file name with the /e switch to encrypt only the named file. This doesn’t affect other files or the folder attribute.
/d
c:\data>cipher /d

The /d switch decrypts encrypted files and folders. This example decrypts all the files in the current folder as long as the user has appropriate privileges. The user must have encrypted the file, been added as an authorized user for the file, or be a data recovery agent.
/d file
c:\data>cipher /d 70-642.rtf

You can unencrypt a single file by specifying the file with the /u switch.
/u /n
c:\>cipher /u
c:\data>cipher /u /n >
encryptedfileslist.txt

The /u switch can be used to locate all encrypted files on all local drives of a system and update them with the data recovery agent’s certificate if it has changed.

This switch is useful if the keys have changed, such as when a new data recovery agent is designated.

When used with the /n switch, it lists the files but does not update them. This is useful for creating a list of encrypted files on a system
c:\data>cipher /k

Creates a new file encryption key for the user.
/w
c:\data>cipher /w:e:
To remove as much data as possible, please close all other applications while
running CIPHER /W.
Writing 0x00
................................................................................
Writing 0xFF
................................................................................
Writing Random Numbers
................................................................................

					  

Removes data from available unused disk space on a drive.

When files are first encrypted, it’s possible that remnants of these files are left on the drive. You can remove all remnants of these files with the /w switch. The example sanitizes the unused disk space on drive E:. Note that it first writes all 0s (0x00) to the unused disk space, writes all 1s (0xFF), and then writes random numbers to the drive.

This can also be done on any NTFS drive, even if there aren’t any encrypted files on the drive.

 
Others
 
- Windows Server 2008 : Copying Files with copy, xcopy, and robocopy
- Windows Vista : Recovering Data (part 3) - Protecting a complete PC
- Windows Vista : Recovering Data (part 2) - Automating data protection
- Windows Vista : Recovering Data (part 1) - Dealing with minor data loss
- Windows Home Server 2011: Monitoring the Network Status with the Launchpad Icon (part 2) - Monitoring Windows Home Server with the Alert Viewer
- Windows Home Server 2011: Monitoring the Network Status with the Launchpad Icon (part 1) - Monitoring the Icon Color, Monitoring Network Health Alerts
- Preparing for Windows Server 2012 : Planning for Windows Server 2012 (part 2) - Migration process
- Preparing for Windows Server 2012 : Planning for Windows Server 2012 (part 1) - Migration scenarios
- Windows 8 : Configuring Networking for Mobile Devices (part 2) - Configuring Alternate Private IP Addresses, Connecting to Networked Projectors
- Windows 8 : Configuring Networking for Mobile Devices (part 1) - Working with Mobility Settings, Configuring Dynamic IP Addresses
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us