是的,这是可以做到的。它只需要一些简单的批量递归。该脚本已完全可以使用。准备好删除缓存文件夹时,只需将echo
命令替换为命令即可。del
:: Hide Commands
@echo off
setlocal EnableExtensions
:: Parse the Local AppData sub path
call :Expand xAppData "%%LocalAppData:%UserProfile%=%%"
set "xFirefox=\mozilla\firefox\profiles"
set "xChrome=\google\chrome\user data"
:: Start at the User directory
pushd "%UserProfile%\.."
:: Loop through the Users
for /D %%D in (*) do if exist "%%~fD%xAppData%" (
rem Check for Firefox
if exist "%%~fD%xAppData%%xFirefox%" (
pushd "%%~fD%xAppData%%xFirefox%"
rem Loop through the Profiles
for /D %%P in (*) do (
if exist "%%~fP\cache" echo "%%~fP\cache"
)
popd
)
rem Check for Chrome
if exist "%%~fD%xAppData%%xChrome%" (
pushd "%%~fD%xAppData%%xChrome%"
rem Loop through the Profiles
for /D %%P in (*) do (
if exist "%%~fP\cache" echo "%%~fP\cache"
)
popd
)
)
popd
goto End
::::::::::::::::::::::::::::::
:Expand <Variable> <Value>
if not "%~1"=="" set "%~1=%~2"
goto :eof
:End
endlocal
pause
更新评论
要使用 Firefox profiles.ini 文件,请将上面的检查 firefox 部分替换为该文件。
rem Check for Firefox INI
if exist "%%~fD%xAppData%%xFirefox%\profiles.ini" (
pushd "%%~fD%xAppData%%xFirefox%\"
rem Loop through the Profiles
for /f "tokens=1,* delims==" %%L in (profiles.ini) do (
if /i "%%~L"=="Path" if exist "%%~fM\cache\" echo "%%~fM\cache"
)
popd
)