Skip to content

Instantly share code, notes, and snippets.

@ted423
Created November 4, 2025 06:35
Show Gist options
  • Save ted423/911f8efccdea6eb7aac7d5aab15e1645 to your computer and use it in GitHub Desktop.
Save ted423/911f8efccdea6eb7aac7d5aab15e1645 to your computer and use it in GitHub Desktop.
disBitlocker.bat
@echo off
setlocal enabledelayedexpansion
REM 遍历所有可能的盘符
for %%D in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
REM 检查盘符是否存在
if exist %%D:\ (
echo -------------------------------
echo [%date% %time%] 检查 %%D:\
manage-bde -status %%D: 2>nul | findstr /C:"转换状态" | findstr /C:"加密" >nul 2>&1
if !errorlevel! equ 0 (
echo %%D: 已启用 BitLocker。准备发起关闭 / 解密...
echo [%date% %time%] %%D: BitLocker ON - 发起 manage-bde -off %%D:
manage-bde -off %%D:
echo 已发送关闭请求到 %%D:\ 解密将在后台运行,可能需要很长时间
echo [%date% %time%] %%D: 已发送 - manage-bde -off %%D:
) else (
echo %%D: 未启用 BitLocker 或状态无法获取。
)
)
)
echo -------------------------------
echo 所有盘符检查完毕。
echo 注意:解密是异步进行的,完成时间取决于磁盘大小与系统负载。
pause
exit /b 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment