Deleting Cookies and internet files in VBS 
Author Message
 Deleting Cookies and internet files in VBS

I know I placed something similar before but, the information I receive was
well appreciated but it did not allow me to delete the Temporary Internet
Files and Cookies folder without generating an access violation error.  The
Temporary Internet Files and Cookies folders seem to have some special
windows protection. NOTE:  I can use this code to delete other directories,
so it does seem to work.  below is the sample code That I am playing with.
Can someone please tell me where I am going wrong?  I am using  win2k Pro:

'This is a test run
'alot of the Echo is to make sure it's doing what it should
'Set WshShell = WScript.CreateObject("WScript.Shell")
'Set WshSpecialFolders = WshShell.SpecialFolders
'For intx = 0 To WshSpecialFolders.Count - 1
' WScript.Echo WshSpecialFolders.Item(intx)&intx

'.Wscript.Echo intx
'Next
'on error resume next
dim fs, fld, f1, fl, s, s1
s1="\ "
s=lcase("c:\documents and settings\administrator\local settings\temporary
Internet

Files\content.ie5\")

's=lcase("c:\documents and settings\administrator\local settings\temporary
Internet

Files\")
's=lcase("c:\documents and settings\administrator\cookies\")

set fs = createobject("Scripting.FileSystemObject")
Set fld = fs.GetFolder(s)
wscript.echo fld
set fl = fld.files
for each f1 in fl
wscript.echo f1
'wscript.echo lcase(s&"index.dat")
if lcase(f1) = lcase(s&"index.dat") then wscript.echo "cannot delete
index.dat"
if lcase(f1) <> lcase(s&"index.dat") and lcase(f1) <> lcase(s&"desktop.ini")
then

fs.DeleteFile(s&"*.*")
'wscript.echo "done"

next

'  "c:\documents and settings\"&userid&"\local settings"
'  "c:\documents and settings\"&userid&"\cookies"



Sun, 09 Jan 2005 12:44:24 GMT  
 Deleting Cookies and internet files in VBS
Change this part below fs.DeleteFile(s&"*.*") to this one fs.DeleteFile(f1)

Sorry about that.


Quote:
> I know I placed something similar before but, the information I receive
was
> well appreciated but it did not allow me to delete the Temporary Internet
> Files and Cookies folder without generating an access violation error.
The
> Temporary Internet Files and Cookies folders seem to have some special
> windows protection. NOTE:  I can use this code to delete other
directories,
> so it does seem to work.  below is the sample code That I am playing with.
> Can someone please tell me where I am going wrong?  I am using  win2k Pro:

> 'This is a test run
> 'alot of the Echo is to make sure it's doing what it should
> 'Set WshShell = WScript.CreateObject("WScript.Shell")
> 'Set WshSpecialFolders = WshShell.SpecialFolders
> 'For intx = 0 To WshSpecialFolders.Count - 1
> ' WScript.Echo WshSpecialFolders.Item(intx)&intx

> '.Wscript.Echo intx
> 'Next
> 'on error resume next
> dim fs, fld, f1, fl, s, s1
> s1="\ "
> s=lcase("c:\documents and settings\administrator\local settings\temporary
> Internet

> Files\content.ie5\")

> 's=lcase("c:\documents and settings\administrator\local settings\temporary
> Internet

> Files\")
> 's=lcase("c:\documents and settings\administrator\cookies\")

> set fs = createobject("Scripting.FileSystemObject")
> Set fld = fs.GetFolder(s)
> wscript.echo fld
> set fl = fld.files
> for each f1 in fl
> wscript.echo f1
> 'wscript.echo lcase(s&"index.dat")
> if lcase(f1) = lcase(s&"index.dat") then wscript.echo "cannot delete
> index.dat"
> if lcase(f1) <> lcase(s&"index.dat") and lcase(f1) <>

lcase(s&"desktop.ini")

- Show quoted text -

Quote:
> then

> fs.DeleteFile(s&"*.*")
> 'wscript.echo "done"

> next

> '  "c:\documents and settings\"&userid&"\local settings"
> '  "c:\documents and settings\"&userid&"\cookies"



Sun, 09 Jan 2005 13:23:41 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How can I delete cookies and temp internet files w/VBS

2. Deleting temporary internet files and cookies using vbscript

3. info : here is how to delete cookies or any file in the temporary internet files folder

4. Delete cookies and temp. inet files with VBS

5. Clearing cache / temporary Internet files / cookies

6. Deleting temporary internet files

7. Deleting Temp internet files

8. delete internet template files

9. Delete all temp internet files for all users

10. deleting temp internet files through script

11. Deleting Temporary Internet Files

12. Deleting Temp Internet Files via script

 

 
Powered by phpBB® Forum Software