Dela via


Cipher

Displays or alters the encryption of folders and files on NTFS volumes. Used without parameters, cipher displays the encryption state of the current folder and any files it contains.

Syntax

cipher [{/e|/d}] [/s:dir] [/a] [/i] [/f] [/q] [/h] [/k] [/u[/n]] [PathName [...]] | [**/r:PathNameWithoutExtension] | [/w:**PathName]

Parameters

/e   : Encrypts the specified folders. Folders are marked so that files that are added to the folder later are encrypted too.

/d   : Decrypts the specified folders. Folders are marked so that files that are added to the folder later are encrypted too.

/s:   dir   : Performs the selected operation in the specified folder and all subfolders.

/a   : Performs the operation for files and directories.

/i   : Continues performing the specified operation even after errors occur. By default, cipher stops when it encounters an error.

/f   : Forces the encryption or decryption of all specified objects. By default, cipher skips files that have been encrypted or decrypted already.

/q   : Reports only the most essential information.

/h   : Displays files with hidden or system attributes. By default, these files are not encrypted or decrypted.

/k   : Creates a new file encryption key for the user running cipher. If you use this option, cipher ignores all of the other options.

/u   : Updates the user's file encryption key or recovery agent's key to the current ones in all of the encrypted files on local drives (that is, if the keys have been changed). This option only works with /n.

/n   : Prevents keys from being updated. Use this option to find all of the encrypted files on the local drives. This option only works with /u.

PathName   : Specifies a pattern, file, or folder.

/r: PathNameWithoutExtension   : Generates a new recovery agent certificate and private key, and then writes them to files with the file name specified in PathNameWithoutExtension. If you use this option, cipher ignores all of the other options.

/w: PathName   : Removes data on unused portions of a volume. PathName can indicate any directory on the desired volume. If you use this option, cipher ignores all of the other options.

/?   : Displays help at the command prompt.

Remarks

  • Using /w 

    /w removes data from portions of the volume it can access and have not been allocated to files or directories. It does not lock the drive, so other programs can obtain space on the drive, which cipher cannot erase. Because this option writes to a large portion of the hard volume, it might take a long time to complete and should only be used when necessary.

  • Encrypting or decrypting files

    To prevent an encrypted file from becoming decrypted when it is modified, it is recommended that you encrypt both the file and the folder in which it resides.

  • Using read-only files and folders

    Cipher cannot encrypt files that are marked as read-only.

  • Using multiple folder names

    You can use multiple folder names and wildcard characters.

  • Using multiple parameters

    You must separate multiple parameters by at least one space.

Examples

To use cipher to encrypt a subfolder named May in a folder named MonthlyReports, type:

cipher /e monthlyreports\may

To encrypt the MonthlyReports folder, the January through December subfolders, and the Manufacturing subfolders within the month subfolders, type:

cipher /e /s:monthlyreports

To encrypt only the Marketing.xls file in the May subfolder, type:

cipher /e /a monthlyreports\may\marketing.xls

To encrypt the Marketing.xls file, the Maintenance.doc file, and the Manufacturing subfolder (located in the May folder), type:

cipher /e /a monthlyreports\may\ma*

To determine whether the May folder is encrypted, type:

cipher monthlyreports\may

To determine which files in the May folder are encrypted, type:

cipher monthlyreports\may\*

Formatting legend

Format

Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

Command-line reference A-Z