作者loser1 (拍嘎爪得白酱)
看板Windows
标题Re: [问题] win 10 资料夹加密方法
时间Wed Aug 17 10:23:29 2022
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://webptt.com/cn.aspx?n=bbs/Windows/M.1660703011.A.5FA.html
1F:→ maniaque: 那些不信任人的虚拟货币以後也会面临到这种的情况 08/17 11:43
2F:→ loser1: XDDD 08/17 11:44
3F:→ maniaque: 把助记词还有金钥记在脑袋,一个突发状况人瘫了还是走了 08/17 11:46
4F:→ maniaque: 瞬间从首富变成赤贫.....:D 08/17 11:46
哥尔‧D‧罗杰:「我把我的金钥放在那里了,想要我的比特币的自己去找吧!」
从此开启了大海贼时代~~~~~
※ 编辑: loser1 (125.227.9.148 台湾), 08/17/2022 11:48:23
5F:→ maniaque: 把密码交给另一半,明天说不定就卷款跟小王跑了 08/17 11:47
6F:→ loser1: 密码分 256 份,八旗旗主各分得 32 份。 08/17 11:49
7F:推 DINJIAPC: 勒索表示原来我再加一层就是我的了 08/17 16:36
每日离线备份是必须的
※ 编辑: loser1 (111.83.244.100 台湾), 08/17/2022 17:45:24