Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

防止 U 盤盜拷數據:註冊表 + 批處理 實現「插入即只讀、需運行腳本才可寫」動態管控

編輯:Windows XP 系統介紹

共用電腦怕數據被 U 盤偷走?註冊表建立「全局寫保護」+ 批處理「臨時解鎖」,用時開、走時鎖,動態管控。

部署步驟 (管理員身份)

  1. 建立全局寫保護註冊表
      Win+R → regedit → HKLM\SYSTEM\CurrentControlSet\Control → 新建項 StorageDevicePolicies → 右側新建 DWORD WriteProtect = 1。
      導出該分支 → 存 C:\y.reg (鎖定狀態)。
  2. 導出解鎖註冊表
      將 WriteProtect 改為 0 → 導出桌面 U盤只讀.reg (解鎖狀態)。
  3. 建立一鍵解鎖批處理
      C:\Windows\System32\yes.bat 內容:
      
    @echo off
    reg import c:\y.reg
    

使用流程

  1. **日常狀態** :WriteProtect=1,插 U 盤只讀,複製文件到 U 盤失敗 → **數據外洩為零**。
  2. **需寫入時** :
      ① 先拔 U 盤。
      ② 運行 Win+R → yes (執行批處理導入解鎖註冊表)。
      ③ 插 U 盤 → 正常讀寫。
      ④ 寫完拔盤 → 雙擊桌面 U盤只讀.reg → 重新鎖定。

進階自動化

  • 用組策略/計劃任務/服務監控 USB 插入事件 → 自動導入鎖定註冊表。
  • 配合 BitLocker To Go / EFS 加密 U 盤,雙重保險。
  • 企業級部署:AD 組策略下發 StorageDevicePolicies,終端無感強制只讀。

動態管控,數據不出門,共用電腦也放心。

Copyright © Windows教程網 All Rights Reserved