Powered by GeSHi

Source code for delflash.bat

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

  1. @ECHO OFF
  2. :: Check Windows version (NT 4+ required)
  3. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  4.  
  5. :: Use local variables
  6. SETLOCAL ENABLEDELAYEDEXPANSION
  7.  
  8. :: Initialize variables
  9. SET Quiet=
  10. SET Count=0
  11. SET Cooky=Cookies
  12. SET FPDir=%UserProfile%\Application Data\Macromedia\Flash Player
  13.  
  14. :: /Q is the only valid (optional) command line argument
  15. IF /I "%~1"=="/Q" (
  16. 	SET Quiet=/Q
  17. ) ELSE (
  18. 	IF NOT "%~1"=="" GOTO Syntax
  19. )
  20.  
  21. IF /I NOT "%Quiet%"=="/Q" (
  22. 	CALL :Syntax
  23. 	ECHO.
  24. 	PAUSE
  25. 	ECHO.
  26. )
  27.  
  28. :: Display a message unless in quiet mode (/Q switch)
  29. IF NOT "%Quiet%"=="/Q" (
  30. 	ECHO Search and destroy Local Shared Objects ^(Flash Cookies^) ...
  31. 	ECHO.
  32. )
  33.  
  34. FOR %%A IN ("macromedia.com\support\flashplayer\sys" "#SharedObjects") DO (
  35. 	PUSHD "%FPDir%\%%~A"
  36. 	IF NOT ERRORLEVEL 1 (
  37. 		FOR /F "tokens=*" %%B IN ('DIR /AD /B "%FPDir%\%%~A\*" 2^>NUL') DO (
  38. 			CD | FIND /I "%FPDir%\%%~A" >NUL
  39. 			IF NOT ERRORLEVEL 1 (
  40. 				SET /A Count = !Count! + 1
  41. 				RD %Quiet% /S "%%~fB"
  42. 				ECHO.
  43. 			)
  44. 		)
  45. 	)
  46. 	POPD
  47. )
  48.  
  49. :: Format the message
  50. IF %Count% EQU 1 SET Cooky=Cooky
  51. IF %Count% EQU 0 SET Count=No
  52.  
  53. :: Display a message unless in quiet mode (/Q switch)
  54. IF NOT "%Quiet%"=="/Q" (
  55. 	ECHO %Count% Flash %Cooky% found.
  56. 	ECHO.
  57. )
  58.  
  59. ENDLOCAL
  60. GOTO:EOF
  61.  
  62.  
  63. :UCName
  64. SET UCName=%~1
  65. SET UCName=%UCName:a=A%
  66. SET UCName=%UCName:b=B%
  67. SET UCName=%UCName:c=C%
  68. SET UCName=%UCName:d=D%
  69. SET UCName=%UCName:e=E%
  70. SET UCName=%UCName:f=F%
  71. SET UCName=%UCName:g=G%
  72. SET UCName=%UCName:h=H%
  73. SET UCName=%UCName:i=I%
  74. SET UCName=%UCName:j=J%
  75. SET UCName=%UCName:k=K%
  76. SET UCName=%UCName:l=L%
  77. SET UCName=%UCName:m=M%
  78. SET UCName=%UCName:n=N%
  79. SET UCName=%UCName:o=O%
  80. SET UCName=%UCName:p=P%
  81. SET UCName=%UCName:q=Q%
  82. SET UCName=%UCName:r=R%
  83. SET UCName=%UCName:s=S%
  84. SET UCName=%UCName:t=T%
  85. SET UCName=%UCName:u=U%
  86. SET UCName=%UCName:v=V%
  87. SET UCName=%UCName:w=W%
  88. SET UCName=%UCName:x=X%
  89. SET UCName=%UCName:y=Y%
  90. SET UCName=%UCName:z=Z%
  91. GOTO:EOF
  92.  
  93.  
  94. :Syntax
  95. IF "%OS%"=="Windows_NT" CALL :UCName "%~nx0"
  96. CLS
  97. ECHO.
  98. IF NOT "%OS%"=="Windows_NT" ECHO %0,  Version 1.00 for Windows NT 4+
  99. IF "%OS%"=="Windows_NT" ECHO %UCName%,  Version 1.00 for Windows NT 4^+
  100. ECHO Delete all "Local Shared Object", also known as "Flash Cookies", from the
  101. ECHO current user's profile
  102. ECHO.
  103. IF NOT "%OS%"=="Windows_NT" ECHO Usage:  %0  [/Q]
  104. IF "%OS%"=="Windows_NT" ECHO ECHO Usage:  %UCName%  [ /Q ]
  105. ECHO.
  106. ECHO Where:  /Q    Quiet mode: no prompt for confirmation, no messages
  107. ECHO.
  108. ECHO Notes:  It is recommended to run this batch file without the /Q switch the
  109. ECHO         first time, with the user ID for which it is intended, to check if
  110. ECHO         the directories to be deleted are the right ones.
  111. ECHO         Though every effort has been made to avoid failures, no guarantee
  112. ECHO         can be made for the proper functioning of this batch file on your
  113. ECHO         computer. Use this batch file entirely at your own risk.
  114. ECHO         To manage "Flash Cookies", visit
  115. ECHO         http://www.macromedia.com/support/documentation/en/flashplayer/help
  116. ECHO         /settings_manager02.html
  117. ECHO.
  118. ECHO Written by Rob van der Woude
  119. ECHO http://www.robvanderwoude.com
  120. IF "%OS%"=="Windows_NT" ENDLOCAL
  121.