加密windows系统的文件夹内容,加密后的文件夹内容只有输入密码后,才能看到。先上代码:
cls
@ECHO OFF
title Folder Private
if EXIST "Locker" goto UNLOCK
if NOT EXIST Private goto MDLOCKER
:CONFIRM
echo Are you sure you want to lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Private "Locker"
attrib +h +s "Locker"
echo Folder locked
goto End
:UNLOCK
echo Enter password to unlock folder
set/p "pass=>"
if NOT %pass%== 你的密码 goto FAIL
attrib -h -s "Locker"
ren "Locker" Private
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Private
echo Private created successfully
goto End
:End
将这段代码复制到文本编辑器,记事本或者Editplus文本编辑器,设置密码,然后保存后缀为.bat即可。
文件夹的加锁和解锁,重复上面的步骤即可。
时间: 2024-10-22 21:35:50