如何以编程方式清除 Microsoft Edge 浏览器缓存?
How to clear Microsoft Edge browser cache programmatically?
有谁知道如何以编程方式清除 Microsoft Edge 的缓存? (.Net、脚本、命令行、删除文件均可)
转到:
%LOCALAPPDATA%\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\
并删除以 #!
开头的文件夹。
在python中您可以进行以下操作
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)
我认为上面给出的位置是错误的。以下是 cookie、历史记录和缓存的位置。
目录:C:\Users%用户名%\AppData\Local\Microsoft\Edge\User Data\Default\Cache
文件:C:\Users%用户名%\AppData\Local\Microsoft\Edge\UserData\Default\Cookies
文件:C:\Users%用户名%\AppData\Local\Microsoft\Edge\UserData\Default\History
有谁知道如何以编程方式清除 Microsoft Edge 的缓存? (.Net、脚本、命令行、删除文件均可)
转到:
%LOCALAPPDATA%\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\
并删除以 #!
开头的文件夹。
在python中您可以进行以下操作
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)
我认为上面给出的位置是错误的。以下是 cookie、历史记录和缓存的位置。
目录:C:\Users%用户名%\AppData\Local\Microsoft\Edge\User Data\Default\Cache
文件:C:\Users%用户名%\AppData\Local\Microsoft\Edge\UserData\Default\Cookies
文件:C:\Users%用户名%\AppData\Local\Microsoft\Edge\UserData\Default\History