Created
September 10, 2019 03:02
-
-
Save cuikangyi/a47e0901c4f273de410ec49344fefc61 to your computer and use it in GitHub Desktop.
微信PC版缓存清理
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal EnableDelayedExpansion | |
echo ------------------------------------------- | |
echo -------- 清理微信7天前视频图片缓存 -------- | |
echo -------- 作者:cky -------- | |
echo ------------------------------------------- | |
for /f "tokens=1,2,* " %%i in ('reg query "HKEY_CURRENT_USER\Software\Tencent\WeChat" /v FileSavePath') do (set WECHAT_PATH=%%k) | |
if %WECHAT_PATH% === "MyDocument:" ( | |
for /f "tokens=1,2,* " %%i in ('reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Personal') do (set DOCUMENT_PATH=%%k) | |
set WECHAT_PATH=%DOCUMENT_PATH%\WeChat Files | |
) | |
echo 您的微信文件的保存位置在"%WECHAT_PATH%" | |
echo, | |
echo 确认要清理吗,确定请输入[y]? | |
set /p confirm_clean= | |
if !confirm_clean! NEQ y ( | |
echo 已取消 | |
pause | |
exit | |
) | |
echo ---------------------------------- | |
echo ---------- 开始扫描.... ---------- | |
echo ---------------------------------- | |
echo, | |
for /d %%a in ("%WECHAT_PATH%\*") do ( | |
echo 确认要清理目录%%a吗,确定请输入[y]? | |
set /p confirm_f= | |
if !confirm_f! NEQ y ( | |
echo 跳过%%a | |
) else ( | |
for /d %%b in ("%%a\FileStorage\Video\*") do ( | |
call :del "%%b" | |
) | |
for /d %%b in ("%%a\FileStorage\Image\*") do ( | |
call :del "%%b" | |
) | |
) | |
) | |
echo ---------------------------------- | |
echo ----------- 全清理完成 ----------- | |
echo ---------------------------------- | |
echo, | |
pause | |
:del | |
echo 正在清理目录... | |
echo %1 | |
forfiles /p %1 /s /d -7 /C "cmd /c echo 删除文件 @file && del /f @path" 2> nul | |
rd /q %1 2> nul | |
echo, | |
goto:eof | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment