設定預設的檔案封鎖行為 的登錄值 openinprotectedview (excel\security\fileblock)使用者HKCU\software\policies\microsoft\office\16.0\excel\security\fileblock

原則 ID
L_SetDefaultFileBlockBehavior
適用範圍
使用者設定
支援的作業系統
至少需要 Windows Server 2008 R2 或 Windows 7
來源
Microsoft 365 Apps / Office Administrative Templates (版本 5568.1000)
類別
Microsoft Excel 2016 › Excel 選項 › 安全性 › 信任中心 › 檔案封鎖設定

登錄

openinprotectedview

REG_DWORD使用者
啟用時的值
取決於選項值
元素
-
選項
項目儲存的值
封鎖的檔案未開啟0
在受保護檢視中開啟封鎖的檔案,但無法編輯該檔案1
在受保護檢視中開啟封鎖的檔案,並可編輯該檔案2
以 .reg · CMD · PowerShell 套用
.reg
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\software\policies\microsoft\office\16.0\excel\security\fileblock]

; 選項 (只使用其中一個)
; 封鎖的檔案未開啟
"openinprotectedview"=dword:00000000
; 在受保護檢視中開啟封鎖的檔案,但無法編輯該檔案
"openinprotectedview"=dword:00000001
; 在受保護檢視中開啟封鎖的檔案,並可編輯該檔案
"openinprotectedview"=dword:00000002
CMD
:: 選項 (只使用其中一個)

:: 封鎖的檔案未開啟
reg add "HKCU\software\policies\microsoft\office\16.0\excel\security\fileblock" /v "openinprotectedview" /t REG_DWORD /d 0 /f
:: 在受保護檢視中開啟封鎖的檔案,但無法編輯該檔案
reg add "HKCU\software\policies\microsoft\office\16.0\excel\security\fileblock" /v "openinprotectedview" /t REG_DWORD /d 1 /f
:: 在受保護檢視中開啟封鎖的檔案,並可編輯該檔案
reg add "HKCU\software\policies\microsoft\office\16.0\excel\security\fileblock" /v "openinprotectedview" /t REG_DWORD /d 2 /f
PowerShell
# 共通: 建立機碼
New-Item -Path 'HKCU:\software\policies\microsoft\office\16.0\excel\security\fileblock' -Force | Out-Null

# 選項 (只使用其中一個)
# 封鎖的檔案未開啟
New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\16.0\excel\security\fileblock' -Name 'openinprotectedview' -PropertyType DWord -Value 0 -Force | Out-Null
# 在受保護檢視中開啟封鎖的檔案,但無法編輯該檔案
New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\16.0\excel\security\fileblock' -Name 'openinprotectedview' -PropertyType DWord -Value 1 -Force | Out-Null
# 在受保護檢視中開啟封鎖的檔案,並可編輯該檔案
New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\16.0\excel\security\fileblock' -Name 'openinprotectedview' -PropertyType DWord -Value 2 -Force | Out-Null