Powered by GeSHi

Source code for adongone.bat

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

  1. @ECHO OFF
  2. ECHO.
  3. ECHO AdOnGone.bat,  Version 1.00 for Windows 2000 and later
  4. ECHO Restore disappeared add-ons after a Firefox 2.*.* update
  5. ECHO.
  6. ECHO Usage with confirmation:  ADONGONE.BAT
  7. ECHO.
  8. ECHO Or without confirmation:  ECHO Y  ADONGONE.BAT
  9. ECHO.
  10. ECHO Notes: Firefox needs to be closed before running this batch file.
  11. ECHO        In Windows XP, you will be asked to close Firefox if it is
  12. ECHO        still running, in Windows 2000 no such check is done.
  13. ECHO        In Windows XP, the command line without confirmation won't
  14. ECHO        work if Firefox is still running.
  15. ECHO.
  16. ECHO Based on a blog entry Thomas Freudenberg
  17. ECHO http://thomasfreudenberg.com/blog/archive/2007/09/20/
  18. ECHO all-firefox-extensions-gone-after-upgrading-to-2-0-7.aspx
  19. ECHO.
  20. ECHO Written by Rob van der Woude
  21. ECHO http://www.robvanderwoude.com
  22.  
  23. IF NOT "%OS%"=="Windows_NT" EXIT
  24. IF NOT "%~1"=="" GOTO:EOF
  25. VER | FIND "Windows NT" >NUL && GOTO:EOF
  26.  
  27. ECHO.
  28. ECHO.
  29.  
  30. SETLOCAL ENABLEDELAYEDEXPANSION
  31.  
  32. VER | FIND.EXE /I "Windows 2000" >NUL
  33. IF ERRORLEVEL 1 (
  34. 	TASKLIST.EXE /FI "IMAGENAME eq FIREFOX.EXE" 2>NUL | FIND /I "FIREFOX.EXE" >NUL
  35. 	IF NOT ERRORLEVEL 1 (
  36. 		ECHO Please close Firefox and press any key to continue . . .
  37. 		PAUSE > NUL
  38. 		TASKKILL.EXE /F /IM FIREFOX.EXE >NUL 2>&1
  39. 		ECHO.
  40. 	)
  41. )
  42. FOR /D %%A IN ("%AppData%\Mozilla\Firefox\Profiles\*.default") DO (
  43. 	SET Found=0
  44. 	FOR %%B IN (cache ini rdf) DO (
  45. 		IF EXIST "%%~fA\extensions.%%B" SET /A Found = !Found! + 1
  46. 	)
  47. 	IF !Found! GTR 0 (
  48. 		ECHO You are about to delete the following !Found! files:
  49. 		ECHO.
  50. 		FOR %%B IN (cache ini rdf) DO (
  51. 			IF EXIST "%%~fA\extensions.%%B" (
  52. 				ECHO "%%~fA\extensions.%%B"
  53. 			)
  54. 		)
  55. 		SET Answer=N
  56. 		ECHO.
  57. 		SET /P Answer=Do you want to continue? [y/N] 
  58. 		IF /I "!Answer:~0,1!"=="Y" (
  59. 			FOR %%B IN (cache ini rdf) DO (
  60. 				IF EXIST "%%~fA\extensions.%%B" (
  61. 					DEL "%%~fA\extensions.%%B"
  62. 				)
  63. 			)
  64. 			ECHO.
  65. 			ECHO Done.
  66. 		)
  67. 	)
  68. )
  69.  
  70. ENDLOCAL
  71.