Microsoft Edge以编程方式删除历史记录和Cookie

时间:2016-12-27 05:42:43

标签: c# vb.net cookies vbscript microsoft-edge

有没有办法删除历史记录&使用VBScript或.net的Microsoft Edge浏览器的cookie?

与Internet Explorer一样,删除历史记录表单“%AppData%\ Local \ Microsoft \ Windows \ History”文件夹或Rundll32命令?

Rundll32命令

删除Cookie: rundll32.exe,InetCpl.cpl,ClearMyTracksByProcess 2

删除历史记录: rundll32.exe,InetCpl.cpl,ClearMyTracksByProcess 1

修改

找到清除Cookie http://winhelp2002.mvps.org/cookies.htm的解决方案。删除以下4个文件夹中的文件将清除cookie,而不会影响历史记录和缓存。

1. \Users\user name\AppData\Local\Packages\Microsoft.MicrosoftEdge_8wekyb3‌​d8bbwe\AC\#!001\MicrosoftEdge\Cookies

2. \Users\user name\AppData\Local\Packages\Microsoft.MicrosoftEdge_8wekyb3‌​d8bbwe\AC\#!002\MicrosoftEdge\Cookies

3. \Users\user name\AppData\Local\Packages\Microsoft.MicrosoftEdge_8wekyb3‌​d8bbwe\AC\#!121\MicrosoftEdge\Cookies

4. \Users\user name\AppData\Local\Packages\Microsoft.MicrosoftEdge_8wekyb3‌​d8bbwe\AC\MicrosoftEdge\Cookies

在不影响Cookie和缓存的情况下仍需帮助清除历史记录

1 个答案:

答案 0 :(得分:1)

这不安全但首先您需要关闭Microsoft Edge浏览器,然后您应该删除所有Sub_Folders和文件位于:

" C:\ Users \ [用户名] \ AppData \本地\套餐\ Microsoft.MicrosoftEdge_8wekyb3d8bbwe"

使用您自己的Windows用户名更改[username]。

VB脚本代码:

Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder("C:\Users\[username]\AppData\Local\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe")

for each f in folder.Files
   On Error Resume Next
   name = f.name
   f.Delete True
   If Err Then
     WScript.Echo "Error deleting:" & Name & " - " & Err.Description
   Else
     WScript.Echo "Deleted:" & Name
   End If
   On Error GoTo 0
Next

For Each f In folder.SubFolders
   On Error Resume Next
   name = f.name
   f.Delete True
   If Err Then
     WScript.Echo "Error deleting:" & Name & " - " & Err.Description
   Else
     WScript.Echo "Deleted:" & Name
   End If
   On Error GoTo 0
Next

注意:运行此源AS管理员

另一种方式:

Call WshShell.Run("powershell -command Get-AppXPackage -AllUsers -Name Microsoft.MicrosoftEdge | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml” -Verbose}")

作为管理员运行