Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1780
  • Last Modified:

Script/Freeware Program to Clear cache for IE7/Firefox for ALL USERS ON Windows XP

Hi all:

I am looking for a way to run a script that will let me clear the browser history/cache of all user profiles present on windows XP systems for BOTH IE7 and Firefox 2.0.0.7

Can anyone help me ASAP? Urgent :/

TIA!
0
vtois
Asked:
vtois
  • 5
  • 4
  • 2
  • +1
1 Solution
 
MshineCommented:
EmpTemp id freeware:

http://www.danish-shareware.dk/soft/emptemp/

I use it. It does require you to manually add the folders you want cleared when
you set it up.. Note in order to see the temporary internet folder and cookies, a
and history folders you must have "Show Hidden Files & Folder"  enabled and uncheck
"Hide Protected Operating system folders" (temporarily)  through
folder options in windows..

Then you simple browse to C:\Documents & Settings\Local Settings" and add
each of the folders to be cleared

If you need help once you get the program installed, post and I will post more detailed
instructions. It is pretty intuitive.
0
 
vtoisAuthor Commented:
Hi Mshine:

As I stated in my question, I need this to be a command-line solution so I can run it as a script... GUI solutions will not work, unless they support commandline feed.
0
 
SysExpertCommented:
I would post this in the VBS, ad MSDOS TA's since they will probably ahve the best command line solutions.

I hope this helps !
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
orangutangCommented:
You can also try CCleaner (http://www.ccleaner.com/download/downloading) which cleans out temporary files for those programs and much more but I don't think it clears the folders for all users.
0
 
MshineCommented:
EmpTemp can be commandline executed... Simply create a BAT file in the
startup folder..

From the EmpTemp Help:

Command line options
/clip makes emptemp run minimized, empty the clipboard and then terminate.
/all makes emptemp run minimized, empty all temp folders and then terminate.
/keepdirs prevents deleting of folders (but not their contents). Also see Options.
The last two can be combined. The order and case of these arguments doesn't matter.
Example: emptemp2.exe /all /keepdirs

0
 
vtoisAuthor Commented:
@orangutang:
can ccleaner be executed via cmdline in the background with no user interaction?

@mshine:
yes, but it requires that I "set it up first"... Doing that to 300+ systems is not ROI-smart

@sysexpert:
thanks for the URL but none pertain to me :/ my case is for Windows XP systems on a Windows 2003 managed domain.
0
 
MshineCommented:
Oh.. well you did not mention anything about 300 machines or a Domain.. ;O)

I actually wrote a command line batch file.. which is run through the startup, but
you would have to distribute the file to every machine.. It was something I worte for
our IT department, because frankly I KNOW none of the users bother keeping their
own machines clean and in order. I have the files at work, but in the morning I
will post them.. Try them on one of your machines, and if they do what you want
then this will be the cheapest way to go.. This will be just to clear the "Temporary
Internet Files" and the "Cookies"
0
 
vtoisAuthor Commented:
I look forward to the batch file mshine! :)
0
 
MshineCommented:
Ok.. sorry for the delay but I had to refresh my memory on what I did here. It was
a little more complicated now that I look over my files again. First I had to write a pretty
simple program in VB which would go out and read the directory structure of the
documents and settings folder.. Basically it would collect the names of all the different
users setup on the machine with local accounts, where all the temp files would be stored.

From there the executible creates the batch file which would delete the existing folders
and it contents, and create new/empty folders in its place.

You basically would deploy two files to each of the computers you want to clean.
1 Batch file to the ALL USERS startup folder, and the EXECUTIBLE file to the C:
drive.

I can zip up these files and send them to you, and if you or anyone you know
owns VB6 (yes I am still using vb6 I have not dove into .NET yet), I can send
the source files for the EXE file.

The EXE file pretty much run silient, and does not use any user input so there
are no controls and does not require INSTALLATION or RUNTIME file deployment.

A few things you need to tell me if you cannot work on the VB source code is
exactly what files you want to cleanup? Just Temporary Internet Files? or do
you want History, Cookies, Temp, and you can even go further and hit the
Windows TEMP and Download Program Files directories as well..

If you know a basic level of VB programming you can edit the code yourself
the do what you want it to.. or I can make the alterations in no time for you
to suit your needs.. I suppose if I were a professional programmer I would have
went one step further and created a CFG file so the user could set the folder
using notepad, but that would have been more programming. I also wrote a version
that autmatically runs Defragmenter as well... But not in the startup, instead we handled
it using "Scheduled Tasks"

Here is what the basic BAT & Code for VB Looks Like:
-----------------------------------------------------------------
Startup Folder BAT:

cd\
c:\AutoClean.exe
cd\
c:\AutoClean.bat

-----------------------------------------------------------------
VB Code for AutoClean.exe:

Option Explicit

Private Sub Form_Load()
Static running As Boolean

Dim AllDirs As New Collection
Dim next_dir As Integer
Dim dir_name As String
Dim sub_dir As String
Dim i As Integer
Dim txt As String
Dim Path As String
Dim file_name As String
Dim fnum As Integer
Dim rdfront As String
Dim mkdirfront As String
Dim back1 As String
Dim back2 As String
Dim back3 As String
Dim back4 As String

    Path = "C:\Documents and Settings"

    On Error Resume Next
    Kill "AutoClean.bat"

       
        next_dir = 1
        AllDirs.Add Path ' Start here.
        Do While next_dir <= 1 'AllDirs.Count
            ' Get the next directory to search.
            dir_name = AllDirs(next_dir)
            next_dir = next_dir + 1
           
' Read directories from dir_name.
            sub_dir = Dir$(dir_name & "\*", vbDirectory)
            Do While sub_dir <> ""
                ' Add the name to the list if
                ' it is a directory.
                If UCase$(sub_dir) <> "PAGEFILE.SYS" And _
                    sub_dir <> "." And sub_dir <> ".." _
                Then
                    sub_dir = dir_name & "\" & sub_dir
                   
                   
'**** Write  ****************
   
    back1 = "\Local Settings\Temporary Internet Files"
    back2 = "\Local Settings\Temp"
    back3 = "\Cookies"
    back4 = "\Local Settings\History"
    rdfront = "rd /s /q "
    mkdirfront = "mkdir "
   
    file_name = "AutoClean.bat"


'Open the file.
    fnum = FreeFile
    Open file_name For Append As fnum
   
'Skip check
    If sub_dir <> "C:\Documents and Settings\All Users" Then
        If sub_dir <> "C:\Documents and Settings\All Users.WINNT" Then

' Read the text.
        Print #fnum, rdfront & Chr(34) & sub_dir & back1 & Chr(34)
        Print #fnum, mkdirfront & Chr(34) & sub_dir & back1 & Chr(34)
        Print #fnum, rdfront & Chr(34) & sub_dir & back2 & Chr(34)
        Print #fnum, mkdirfront & Chr(34) & sub_dir & back2 & Chr(34)
        'Print #fnum, rdfront & Chr(34) & sub_dir & back3 & Chr(34)
        'Print #fnum, mkdirfront & Chr(34) & sub_dir & back3 & Chr(34)
    End If
        End If
' End of skip check
' Close the file.
        Close fnum
           
'**** End Write****************


                   
                    On Error Resume Next
                    If GetAttr(sub_dir) And vbDirectory _
                        Then AllDirs.Add sub_dir
                End If
                sub_dir = Dir$(, vbDirectory)
            Loop
            DoEvents
            If Not running Then Exit Do
        Loop
       
'**** Write End ****************

    'file_name = "AutoClean.bat"


'Open the file.
    'fnum = FreeFile
    'Open file_name For Append As fnum

    ' Read the text.
        'Print #fnum, "rd /s /q " & Chr(34) & "C:\WINNT\Downloaded Program Files" & Chr(34)
        'Print #fnum, "mkdir " & Chr(34) & "C:\WINNT\Downloaded Program Files" & Chr(34)
        'Print #fnum, "contig -s c:\*"
' Close the file.
        'Close fnum
           
'**** End Write****************


Unload Form1
End Sub
-----------------------------------------------------------------

I know this is a lot to read, but the application is quite simple, and if run daily happens
very quickly.. Initial cleans might run a bit longer depending on how much stuff has
to be deleted.. after the initial run.. it runs and finishes in less than 2-3 seconds..
0
 
MshineCommented:
I just realized you had Firefox listed as well... That can be programmed in, I would
just need to knopw what folders the Firefox stores is temp files in. ;O)
0
 
vtoisAuthor Commented:
Coolio!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now