Cipher

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

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:Folder] [/a] [/i] [/f] [/q] [/h] [/k] [/u[/n]] [{PathName [...]] | **/r:**PathNameWithoutExtension | **/w:PathName | /x[:**PathName] PathNameWithoutExtension}]

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: Folder
    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.
  • /x[:PathName] PathNameWithoutExtension
    Identifies the certificates and private keys used by EFS for the currently logged on user and backs them up to a file. If PathName is provided, the certificate used to encrypt the file specified are backed up. Otherwise, the user's current EFS certificate and keys will be backed up. The certificates and private keys are written to a file name specified by PathNameWithoutExtension and are given the file name extension .pfx. 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 back up the certificate and private key currently used to encrypt and decrypt EFS files to a file named c:\myefsbackup.pfx, type:

cipher /x c:\myefsbackup

To encrypt the MonthlyReports folder and all 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 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

See Also

Concepts

Command-line reference A-Z
Command shell overview