Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for ffxcac.bat

(view source code of ffxcac.bat as plain text)

  1. @ECHO OFF
  2. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  3. SETLOCAL
  4. IF NOT  "%~1"==""           GOTO Syntax
  5.  
  6. TASKLIST.EXE /? >NUL 2>&1
  7. IF NOT ERRORLEVEL 1 (
  8. 	TASKLIST.EXE /FI "imagename eq firefox.exe" 2>NUL | FIND /I "firefox.exe" >NUL
  9. 	IF NOT ERRORLEVEL 1 (
  10. 		ECHO.
  11. 		ECHO Firefox is still active in memory.
  12. 		ECHO Please close Firefox and try again.
  13. 		GOTO Syntax
  14. 	)
  15. )
  16.  
  17. FOR /D %%A IN ("%UserProfile%.\..\*.*") DO (
  18. 	IF EXIST "%%~fA\Local Settings\Application Data\Mozilla\Firefox\Profiles\" (
  19. 		FOR /D %%B IN ("%%~fA\Local Settings\Application Data\Mozilla\Firefox\Profiles\*.*") DO (
  20. 			FOR %%C IN (Cache Cache.Trash OfflineCache) DO (
  21. 				PUSHD "%%~fB\%%~C" 2>NUL
  22. 				FOR /F "tokens=*" %%D IN ('CD') DO (
  23. 					 IF /I "%%~D"=="%%~fB\%%~C" RD /Q /S "%%~fB\%%~C" 2>NUL
  24. 				)
  25. 				POPD
  26. 			)
  27. 		)
  28. 	)
  29. )
  30. ENDLOCAL
  31. GOTO:EOF
  32.  
  33.  
  34. :Syntax
  35. ECHO.
  36. ECHO FfxCAC.bat,  Version 1.10 for Windows XP and later
  37. ECHO Flush the Firefox cache directories in ALL local profiles
  38. ECHO.
  39. ECHO Usage:  FFXCAC
  40. ECHO.
  41. ECHO Note:   This batch file can't clear the current user's cache if Firefox is
  42. ECHO         running. In Windows XP, it will check if Firefox is active and abort
  43. ECHO         if so. In older Windows versions, this condition will generate errors.
  44. ECHO.
  45. ECHO Written by Rob van der Woude
  46. ECHO http://www.robvanderwoude.com
  47.  
  48. IF "%OS%"=="Windows_NT" ENDLOCAL
  49.  

page last modified: 2024-04-16; loaded in 0.0172 seconds