有人知道如何以编程的方式清除 Microsoft Edge 的缓存吗?(使用 .Net、脚本、命令行或删除文件的方式都可以)
我认为上面给出的位置是错误的。以下是cookie、历史记录和缓存的位置。
目录:C:\Users%username%\AppData\Local\Microsoft\Edge\User Data\Default\Cache
文件:C:\Users%username%\AppData\Local\Microsoft\Edge\User Data\Default\Cookies
文件:C:\Users%username%\AppData\Local\Microsoft\Edge\User Data\Default\History
前往:
%LOCALAPPDATA%\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\
#!
开头的文件夹。def _edgeClearTemp():
appdata_location = os.environ.get('LOCALAPPDATA')
_edgeTempDir = r"{0}\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC".format(
appdata_location)
_edgeAppData = r"{0}\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AppData".format(
appdata_location)
try:
os.system("taskkill /F /IM MicrosoftEdge.exe")
except:
pass
try:
os.system("taskkill /F /IM dllhost.exe")
except:
pass
if os.path.exists(_edgeTempDir):
for directory in os.listdir(_edgeTempDir):
if directory.startswith('#!'):
shutil.rmtree(
os.path.join(_edgeTempDir, directory), ignore_errors=True)
if os.path.exists(_edgeAppData):
shutil.rmtree(_edgeAppData, ignore_errors=True)