用 PowerShell 删除一些历史记录

PowerShell 是一种强大的命令行工具,可以用来执行各种操作,包括删除一些历史记录。历史记录是指在使用计算机时产生的一些数据,例如浏览器缓存、cookies、临时文件、搜索记录等。这些历史记录可能会占用磁盘空间,影响计算机性能,或者泄露个人隐私。因此,有时候我们需要定期清理这些历史记录,以保持计算机的清洁和安全。

删除 PowerShell 历史记录

Remove-Item (Get-PSReadlineOption).HistorySavePath
del $env:appdata\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt

清理 Windows 更新

Stop-Service -Name wuauserv
Remove-Item -Path "$env:SystemRoot\SoftwareDistribution\Download\*" -Force
Start-Service -Name wuauserv

清理 Windows 日志

Clear-EventLog -LogName "Application"
Clear-EventLog -LogName "Security"
Clear-EventLog -LogName "System"

删除 Microsoft Edge 缓存和Cookies

Clear-DnsClientCache
Clear-BrowsingData -IncludeCookies -Confirm:$false -BrowserType Chromium
Clear-Cookie -Confirm:$false -BrowserType Chromium

设置 Windows安全中心->保护历史记录 留存天数

Set-MpPreference -ScanPurgeItemsAfterDelay 7
文章作者: 若海; 原文链接: https://www.rehiy.com/post/546/; 转载需声明来自技术写真 - 若海

添加新评论