打开PowerShell,输入以下命令来关闭Chrome历史记录,该命令不会清空历史记录:
$path = "C:\Users\$env:USERNAME\AppData\Local\Google\Chrome\User Data\Default\History"
icacls $path /reset
icacls $path /inheritance:r
icacls $path /grant Everyone:R
输入以下命令来开启历史记录:
$path = "C:\Users\$env:USERNAME\AppData\Local\Google\Chrome\User Data\Default\History"
icacls $path /reset
icacls $path /inheritance:r
icacls $path /grant:r Everyone:F
注意,关闭历史记录之后,最近关闭页面功能仍然开启,Ctrl+Shift+T恢复最近关闭页面的快捷键依旧能使用
原理:Chrome的历史记录存在C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default\
下的History
文件里,只授予Everyone只读权限,Chrome便添加不了历史记录。如果没有读权限,Chrome打开时会有一个报错。