Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

cipher

Feedback

In this article

Displays or alters the encryption of directories and files on NTFS volumes. If used without parameters,cipher displays the encryption state of the current directory and any files it contains.

Syntax

cipher [/e | /d | /c] [/s:<directory>] [/b] [/h] [pathname [...]]cipher /kcipher /r:<filename> [/smartcard]cipher /u [/n]cipher /w:<directory>cipher /x[:efsfile] [filename]cipher /ycipher /adduser [/certhash:<hash> | /certfile:<filename>] [/s:directory] [/b] [/h] [pathname [...]]cipher /removeuser /certhash:<hash> [/s:<directory>] [/b] [/h] [<pathname> [...]]cipher /rekey [pathname [...]]

Parameters

ParametersDescription
/bAborts if an error is encountered. By default,cipher continues to run even if errors are encountered.
/cDisplays information on the encrypted file.
/dDecrypts the specified files or directories.
/eEncrypts the specified files or directories. Directories are marked so that files that are added afterward will be encrypted.
/hDisplays files with hidden or system attributes. By default, these files are not encrypted or decrypted.
/kCreates a new certificate and key for use with Encrypting File System (EFS) files. If the/k parameter is specified, all other parameters are ignored.
/r:<filename> [/smartcard]Generates an EFS recovery agent key and certificate, then writes them to a .pfx file (containing certificate and private key) and a .cer file (containing only the certificate). If/smartcard is specified, it writes the recovery key and certificate to a smart card, and no .pfx file is generated.
/s:<directory>Performs the specified operation on all subdirectories in the specifieddirectory.
/u [/n]Finds all encrypted files on the local drive(s). If used with the/n parameter, no updates are made. If used without/n,/u compares the user's file encryption key or the recovery agent's key to the current ones, and updates them if they have changed. This parameter works only with/n.
/w:<directory>Removes data from available unused disk space on the entire volume. If you use the/w parameter, all other parameters are ignored. The directory specified can be located anywhere in a local volume. If it is a mount point or points to a directory in another volume, the data on that volume is removed.
/x[:efsfile] [<FileName>]Backs up the EFS certificate and keys to the specified file name. If used with:efsfile,/x backs up the user's certificate(s) that were used to encrypt the file. Otherwise, the user's current EFS certificate and keys are backed up.
/yDisplays your current EFS certificate thumbnail on the local computer.
/adduser [/certhash:<hash>/certfile:<filename>]
/rekeyUpdates the specified encrypted file(s) to use the currently configured EFS key.
/removeuser /certhash:<hash>Removes a user from the specified file(s). TheHash provided for/certhash must be the SHA1 hash of the certificate to remove.
/?Displays help at the command prompt.

Remarks

  • If the parent directory is not encrypted, an encrypted file could become decrypted when it is modified. Therefore, when you encrypt a file, you should also encrypt the parent directory.

  • An administrator can add the contents of a .cer file to the EFS recovery policy to create the recovery agent for users, and then import the .pfx file to recover individual files.

  • You can use multiple directory names and wildcards.

  • You must put spaces between multiple parameters.

Examples

To display the encryption status of each of the files and subdirectories in the current directory, type:

cipher

Encrypted files and directories are marked with anE. Unencrypted files and directories are marked with aU. For example, the following output indicates that the current directory and all its contents are currently unencrypted:

Listing C:\Users\MainUser\Documents\New files added to this directory will not be encrypted.U PrivateU hello.docU hello.txt

To enable encryption on the Private directory used in the previous example, type:

cipher /e private

The following output displays:

Encrypting files in C:\Users\MainUser\Documents\Private             [OK]1 file(s) [or directorie(s)] within 1 directorie(s) were encrypted.

Thecipher command displays the following output:

Listing C:\Users\MainUser\Documents\New files added to this directory will not be encrypted.E PrivateU hello.docU hello.txt

Where thePrivate directory is now marked as encrypted.

Related links


Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

  • Last updated on

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?