解除 Windows 下载文件的"锁定"标记
用 Unblock-File 去掉网上下载文件自带的阻止标记,运行时不再弹警告。
运行 `Unblock-File -Path "文件路径"`(例如某个下载的安装包),即可清除 Windows 给它加的"已阻止"标记。
01命令
命令
$ Unblock-File -Path "C:\Users\me\Downloads\setup.exe"02作用说明
从浏览器或邮件保存的文件都带有一个隐藏的 Zone.Identifier 标记(称为 Mark of the Web),它会让 Windows 提示"此文件来自其他计算机",脚本类文件甚至会被直接禁止运行。Unblock-File 会删除这个标记;想先确认是否存在,可运行 `Get-Item 文件 | Select-Object -ExpandProperty Stream`。在管理员终端中还可以用 `Unblock-File -Path "C:\Tools\*"` 一次性解除整个文件夹。
03风险
!注意: 只对自己信任来源的文件解除锁定——这个标记是 Windows 和 Defender 拦截网络下载脚本的重要防线。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- Unblock-File依据: Unblock-File removes the Zone.Identifier alternate data stream (Mark of the Web) that Windows adds to files downloaded from the internet.
- Reg - Read and edit the registry依据: reg query can inspect the Zone.Identifier stream information stored for downloaded files.
最后验证: 2026-09-18 · 分类: 安全与隐私