利用批次檔搭配 attrib +h +s 系統隱藏屬性,並將資料夾重命名為控制台擴充名(Control Panel.{CLSID}),使其在總管中偽裝為控制台項目,配合密碼驗證實現簡易加密隱藏。
cls
@ECHO OFF
title Folder 秘密資料夾
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST 秘密資料夾 goto MDLOCKER
:CONFIRM
echo 確定要鎖定資料夾嗎?(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 輸入錯誤。
goto CONFIRM
:LOCK
ren 秘密資料夾 "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo 資料夾已鎖定
goto End
:UNLOCK
echo 請輸入密碼解鎖
set/p "pass=>"
if NOT %pass%== 111111 goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" 秘密資料夾
echo 解鎖成功
goto End
:FAIL
echo 密碼錯誤
goto end
:MDLOCKER
md 秘密資料夾
.bat(如 locker.bat)。.bat,輸入 Y 鎖定(資料夾變隱藏、偽裝為控制台)。.bat 輸入密碼(預設 111111,可自行修改程式碼中密碼),資料夾恢復顯示。




attrib -h -s 強制顯示。