顯示或改變NTFS磁碟區上的目錄和檔案加密。 如果不帶參數使用, cipher 則顯示目前目錄及其包含的任何檔案的加密狀態。
Syntax
cipher [/e | /d | /c] [/s:<directory>] [/b] [/h] [pathname [...]]
cipher /k
cipher /r:<filename> [/smartcard]
cipher /u [/n]
cipher /w:<directory>
cipher /x[:efsfile] [filename]
cipher /y
cipher /adduser [/certhash:<hash> | /certfile:<filename>] [/s:directory] [/b] [/h] [pathname [...]]
cipher /removeuser /certhash:<hash> [/s:<directory>] [/b] [/h] [<pathname> [...]]
cipher /rekey [pathname [...]]
Parameters
| Parameters | Description |
|---|---|
| /b | 如果發生錯誤,則中止。 依預設, cipher 即使遇到錯誤,也會繼續執行。 |
| /c | 顯示加密檔案的相關信息。 |
| /d | 解密指定的檔案或目錄。 |
| /e | 加密指定的檔案或目錄。 目錄會標示為之後新增的檔案將會加密。 |
| /h | 顯示具有隱藏或系統屬性的檔案。 根據預設,這些檔案不會加密或解密。 |
| /k | 建立新的憑證和金鑰,以與加密文件系統 (EFS) 檔案搭配使用。 如果指定 /k 參數,則會忽略所有其他參數。 |
/r:<filename> [/智慧卡] |
產生EFS修復代理程式密鑰和憑證,然後將它們寫入 .pfx 檔案(包含憑證和私鑰),以及.cer檔案(只包含憑證)。 如果指定 /smartcard ,它會將復原金鑰和憑證寫入智慧卡,而且不會產生 .pfx 檔案。 |
/s:<directory> |
對指定 目錄中的所有子目錄執行指定的作業。 |
| /u [/n] | 尋找本機磁碟驅動器上所有加密的檔案。 如果與 /n 參數搭配使用,則不會進行任何更新。 如果不使用 /n,則 /u 會將使用者的檔案加密金鑰或復原代理程式的金鑰與目前的金鑰進行比較,並在變更時進行更新。 此參數僅適用於 /n。 |
/w:<directory> |
從整個磁碟區上可用未使用的磁碟空間中移除數據。 如果您使用 /w 參數,則會忽略所有其他參數。 指定的目錄可以位於本機磁碟區中的任何位置。 如果是裝入點或指向另一個磁碟區中的目錄,則會移除該磁碟區上的數據。 |
/x[:efsfile] [<FileName>] |
將 EFS 憑證和金鑰備份至指定的檔案名。 如果與 :efsfile 搭配使用, /x 會備份用來加密檔案的使用者憑證。 否則,會備份使用者目前的 EFS 憑證和金鑰。 |
| /y | 在本機計算機上顯示您目前的EFS憑證縮圖。 |
/adduser [/certhash:<hash> |
/certfile:<filename>] |
| /rekey | 更新指定的加密檔案,以使用目前設定的 EFS 金鑰。 |
/removeuser /certhash:<hash> |
從指定的檔案中移除使用者。 為 /certhash 提供的雜湊必須是要移除之憑證的 SHA1 雜湊。 |
| /? | 在命令提示字元中顯示說明。 |
Remarks
如果未加密父目錄,加密的檔案可能會在修改時解密。 因此,當您加密檔案時,也應該加密父目錄。
系統管理員可以將.cer檔案的內容新增至 EFS 復原原則,以建立使用者的復原代理程式,然後匯入 .pfx 檔案以復原個別檔案。
您可以使用多個目錄名稱和通配符。
您必須在多個參數之間放置空格。
Examples
若要顯示目前目錄中每個檔案和子目錄的加密狀態,請輸入:
cipher
加密的檔案和目錄會標有 E。未加密的檔案和目錄會標有 U。例如,下列輸出指出目前目錄及其所有內容目前未加密:
Listing C:\Users\MainUser\Documents\
New files added to this directory will not be encrypted.
U Private
U hello.doc
U hello.txt
若要在上一個範例中使用的 Private 目錄上啟用加密,請輸入:
cipher /e private
下列輸出會顯示:
Encrypting files in C:\Users\MainUser\Documents\
Private [OK]
1 file(s) [or directorie(s)] within 1 directorie(s) were encrypted.
此 cipher 命令會顯示下列輸出:
Listing C:\Users\MainUser\Documents\
New files added to this directory will not be encrypted.
E Private
U hello.doc
U hello.txt
其中 Private 目錄現在標示為已加密。