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

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