Re: [問題] win 10 資料夾加密方法

看板Windows作者 (拍嘎爪得白醬)時間1年前 (2022/08/17 10:23), 1年前編輯推噓1(106)
留言7則, 3人參與, 1年前最新討論串2/2 (看更多)
1. 在 registry 上面, HKEY_CLASSES_ROOT\*\shell 下加一個機碼, command 裡加程式 "C:\\bin\\EncryptFILE.BAT "%1"" 然後 EncryptFILE.BAT 裡面寫上 "%PROGRAMFILES%\7zip\7z.exe" a -pPASSWORD -y "%~dp1%~n1.Encrypted.zip" "%~1" if exist "%~dp1%~n1.Encrypted.zip" del "%~1" (PASSWORD 用你自己要的密碼) 這時任何右鍵就可以直接加密檔案 2. 暴力加密法: 到根目錄下 for /r %i in (*.txt *.doc* *.xls* *.pdf* ) do "c:\bat\EncryptFILE.BAT" "%~i" 讓它跑一個晚上就可以把所有應該加密的檔案都加密 要用時再解開,改完再壓回去就好。 3. 用 VBS 也可以直接在 office 檔案上加密,程式如下: ------------------------------------------------------------------- if wScript.Arguments.Count < 3 then wScript.Echo "Need Input File, OldPassword, NewPassword" wScript.Quit end if Set objFSO = CreateObject("Scripting.FileSystemObject") src_name = Wscript.Arguments.Item(0) oldpassword = Wscript.Arguments.Item(1) newpassword = Wscript.Arguments.Item(2) src_file = objFSO.GetAbsolutePathName(src_name) if not objFSO.FileExists(src_file) then wScript.Echo "File "&src_File&" does not exist" wScript.Quit end if src_ext = objFSO.GetExtensionName(src_file) if LCase(src_ext) = "doc" OR LCase(src_ext) = "docx" then SetDOCPassword src_file,oldpassword,newpassword elseif LCase(src_ext) = "ppt" OR LCase(src_ext) = "pptx" then SetPowerPointPassword src_file,oldpassword,newpassword elseif LCase(src_ext) = "xls" OR LCase(src_ext) = "xlsx" then SetEXCELPassword src_file,oldpassword,newpassword end if wScript.Quit Public Sub SetDOCPassword (src_file,oldpassword,newpassword) '' wScript.Echo "SetDOCPassword "&src_file&","&oldpassword&","&newpassword dim oWord dim myDOC set oWord = CreateObject("Word.Application") 'oWord.Visible = TRUE oWord.Visible = FALSE On Error Resume Next set myDOC = Nothing set myDOC =oWord.Documents.Open(src_file,FALSE,FALSE,FALSE,oldpassword) if Not myDOC is Nothing then ' myDOC.Password = newpassword ' myDOC.Save ' wScript.Echo "new password=>"&newpassword&"<" oWord.DisplayAlerts = FALSE if newpassword = "" then 'myDoc.ProtectionType = -1 ' wdNoProtection myDoc.EncryptionProvider = "" myDOC.SaveAs2 src_file,,FALSE,"",FALSE,"" else ' wScript.Echo "set password "&newpassword myDOC.Password = newpassword myDOC.Save 'myDOC.SaveAs2 src_file,,FALSE,newpassword end if myDOC.Close else ' wScript.Echo "myDOC is nothing" end if oWord.Quit End Sub Public Sub SetPowerPointPassword (src_file,oldpassword,newpassword) ' wScript.Echo "SetPowerPointPassword "&src_file&","&oldpassword&","&newpassword dim oPowerPoint dim myDOC dim myPresView set oPowerPoint = CreateObject("PowerPoint.Application") ' oPowerPoint.Visible = TRUE On Error Resume Next 'if oldpassword <> "" then set myPresView = Nothing set myPresView =oPowerPoint.ProtectedViewWindows.Open(src_file,oldpassword) if myPresView is Nothing then oPowerPoint.Quit Exit Sub end if set myDOC = Nothing ' wScript.Echo myPresView.SourceName set myDOC = myPresView.Edit(oldpassword) 'else ' set myDOC = Nothing ' ' set myDOC = oPowerPoint.Presentations.Open(src_file,FALSE) 'end if if Not myDOC is Nothing then ' myDOC.Password = newpassword ' myDOC.Save ' wScript.Echo "new password=>"&newpassword&"<" oPowerPoint.DisplayAlerts = FALSE myDOC.Password=newpassword if newpassword = "" then myDOC.PasswordEncryptionProvider = "" myDOC.PasswordEncryptionFileProperties = FALSE end if myDOC.SaveAs src_file myDOC.Close else ' wScript.Echo "myDOC is nothing" end if oPowerPoint.Quit End Sub Public Sub SetExcelPassword (src_file,oldpassword,newpassword) ' wScript.Echo "SetEXCELPassword "&src_file&","&oldpassword&","&newpassword dim oExcel dim myDOC set oExcel = CreateObject("Excel.Application") ' oExcel.Visible = TRUE On Error Resume Next set myDOC = Nothing set myDOC =oExcel.Workbooks.Open(src_file,FALSE,FALSE,,oldpassword) if Not myDOC is Nothing then ' myDOC.password = newpassword ' myDOC.Save ' wScript.Echo "new password=>"&newpassword&"<" oExcel.DisplayAlerts = FALSE if newpassword = "" then myDoc.Unprotect oldpassword myDOC.SaveAs src_file,myDOC.FileFormat,newpassword else myDOC.SaveAs src_file,myDOC.FileFormat,newpassword end if myDOC.Close else ' wScript.Echo "myDOC is nothing" end if oExcel.Quit End Sub ----------------------------------------------------------------------------- 用 cscript 執行這個程式可以加密一個檔案,第 一個參數是檔案,第二個參數是舊密碼,第三個參數是新密碼 若舊檔案沒有密碼,舊密碼要寫新密碼,不可以給空值,不然你會被已加密過的檔案煩死 ------------------------------------------------------------------------------ 一樣到上層目錄執行 f for /r %i in ( *.doc* *.ppt* *.xls*) do ( cscript encryptfile.vbs "%~i" "%OLDPASSWORD%" "%NEWPASSWORD%" ) ============================================================================ 以上均在 CMD 視窗下執行 不要忘記自己密碼,不然自作孽不可活 記得密碼要用紙寫下來放在可信賴同夥身上,不然那天出車禍公司就褂了 ※ 引述《vickyjay1 ()》之銘言: : 因為工作涉及大量敏感個資 : 公司要求電腦內所有檔案必須加密 : 若是用壓縮檔加密有點麻煩 : 常常要用到的檔案就要解壓縮 用完再壓縮 : 已試過無法用右鍵-->內容的方式加密 : 因為公司電腦有設定管理人權限 : 第三方軟體加密也不行,公司有管制 : 所以想詢問還有什麼快速的方法 : 可以直接將資料夾加密? : 先謝謝各位幫忙!! -- 記者:「部長部長,這個問題全國現在都很關心,請您立刻表示一下意見吧?」 部長:「嗯~~啊~~大家辛苦啦!」 -- 「唉呀又是大毛回來啦三更半夜老是不帶鑰匙這個月已經是第三次啦!  爸爸這麼大把年紀還要為你開門明天還要應付那群尖酸刻薄幼稚無知的記~者~!」 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 125.227.9.148 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Windows/M.1660703011.A.5FA.html

08/17 11:43, 1年前 , 1F
那些不信任人的虛擬貨幣以後也會面臨到這種的情況
08/17 11:43, 1F

08/17 11:44, 1年前 , 2F
XDDD
08/17 11:44, 2F

08/17 11:46, 1年前 , 3F
把助記詞還有金鑰記在腦袋,一個突發狀況人癱了還是走了
08/17 11:46, 3F

08/17 11:46, 1年前 , 4F
瞬間從首富變成赤貧.....:D
08/17 11:46, 4F
哥爾‧D‧羅傑:「我把我的金鑰放在那裡了,想要我的比特幣的自己去找吧!」 從此開啟了大海賊時代~~~~~ ※ 編輯: loser1 (125.227.9.148 臺灣), 08/17/2022 11:48:23

08/17 11:47, 1年前 , 5F
把密碼交給另一半,明天說不定就捲款跟小王跑了
08/17 11:47, 5F

08/17 11:49, 1年前 , 6F
密碼分 256 份,八旗旗主各分得 32 份。
08/17 11:49, 6F

08/17 16:36, 1年前 , 7F
勒索表示原來我再加一層就是我的了
08/17 16:36, 7F
每日離線備份是必須的 ※ 編輯: loser1 (111.83.244.100 臺灣), 08/17/2022 17:45:24
文章代碼(AID): #1Y_54ZNw (Windows)
文章代碼(AID): #1Y_54ZNw (Windows)