Delete temporary internet files from specific site

Started by Orionbelt, October 09, 2014, 01:01:42 PM

Previous topic - Next topic

Orionbelt

Hi,
   I am not a programer and trying to learn winbatch.
I am trying to delete temporary internet files from specific site. For example, if temp file belongs to http://support.microsoft.com i would like to remove from every users profile. Now i can make it to every profile but can't get mind to pull file properties to match and deletes files. here is my simple code.
ProfilesList  = DirItemize ("C:\users\*.*")
   ProfilesCount = ItemCount(ProfilesList, @tab)

;   message( "Profile Lists", ProfilesCount )


   ;Record all users account informations.
;
   PeopleList = ProfilesList
   i = ItemLocate ("Administrator", PeopleList, @Tab)
   If i != 0
      PeopleList = ItemRemove (i, PeopleList, @Tab)
   EndIf
   
   i = ItemLocate ("All Users", PeopleList, @Tab)
   If i != 0
      PeopleList = ItemRemove (i, PeopleList, @Tab)
   EndIf
   
   i = ItemLocate ("Default User", PeopleList, @Tab)
   If i != 0
      PeopleList = ItemRemove (i, PeopleList, @Tab)
   EndIf

   i = ItemLocate ("Public", PeopleList, @Tab)
   If i != 0
      PeopleList = ItemRemove (i, PeopleList, @Tab)
   EndIf

   i = ItemLocate ("ADMINI~1", PeopleList, @Tab)
   If i != 0
      PeopleList = ItemRemove (i, PeopleList, @Tab)
   EndIf



   message( "Profile Lists", PeopleList )

    ProfilesCount = ItemCount(PeopleList, @tab)

    For i = 1 to ProfilesCount
          UserKey = ItemExtract(i,PeopleList,@TAB)

          message( "Profile Lists", UserKey )               ; Will get indivialual user name like ausman
         
   


   Next
===================================================================================
In other words, i would like to clear all history items related to microsoft.com web-site

td

The example in the following Tech Database article can be modified to get specific site temporary files:

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WIL~Extenders/WinInet+Delete~Temporary~Internet~Files~Cache.txt

If you simply wanted to delete all the temporary Internet files, you could do so by deleting the users specific .dat(s) file from an admin account. However, it appears that you would need to be able to logon as each user to use the above script to delete specific entries for that user. 

Perhaps someone else can come up with a better solution.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Orionbelt

hi td,
  thanks for replying me back. is there way to change\modify to specific site.
I know how to delete all temporary internet files, but i am looking for just a specific site removal. For example, http://support.microsoft.com


td

Apparently, I did make the point clearly so will give it another try.  You can use the script in the Tech Database to delete specific site specific temporary files by checking the URL before calling the delete API function.  However, as mentioned, it appears that you would need to impersonate a specific user to delete the temporary files of that user.  I am not aware of a way to point the WinInet APIs used in the Tech Database script at the cache of another user without impersonating that user.

It may be possible to delete another user's temporary Internet files without impersonating the user by parsing the structure of the appropriate  data and index file for each user, remove the desired information and rebuild the file. However, I have not tried this and do not know of any API's that assist in this task other than the WinInet APIs previously mentioned. 

I assume that the shell extension responsible for displaying and allow a user to delete entries in the cache has interface methods that can perform the task but it would require a good deal of investigation and likely be very difficult, if not impossible to implement in WinBatch.

There certainly are ways to accomplish the task.  I am just not aware of any that make sense in the context of a WinBatch script. Hopefully, someone else knows of such a way.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade