Helping people with computers... one answer at a time.

Cookies do accumulate and while they are mostly harmless there are occasionally reasons to clean them up. We'll set up a nightly task to do just that.

My homepage is set to I know to use Yahoo, one has to accept hundreds of cookies and I get hundreds. Is there any way one can program the computer to automatically remove the cookies?

Yes and no.

Yes, we can absolutely set something up that will automatically remove cookies, say every night. I'll show you how to do that.

No, in that it's not a simple function built into the system.

There is a simple function built into many browsers, but it perhaps does more than you want.


Current browsers offer something called "InPrivate" (IE), "Incognito" (Chrome), or "Private" (FireFox) browsing mode.

InPrivate mode in Internet Explorer

By using this mode, the browser accepts and uses cookies as normal as long as the browser session or tab is running. However, once closed, the cookies are deleted.

But then, so are a lot of other things.

Along with the cookies, almost everything else associated with the browsing session is also deleted, including all history (typically including browser, search, download, and web form history) and any temporary internet files. Downloads and bookmarks that you make while in this mode are typically kept.

If that's all acceptable to you, then simply remember to enter in to your browser's appropriate version of Private browsing, and when you're done, all of your cookies will be deleted.

A more flexible alternative: CCleaner

I've written about CCleaner before. It's a general purpose cleaning tool for Windows.

And one of the things that it cleans and cleans well are cookies.

When you install CCleaner, it'll ask an interesting question:

Intelligently scan for cookies to keep?

Answer yes to this. I'll go into more detail about this useful setting shortly.

To clean only cookies, in the default view on the Cleaner tab, make sure that only Cookies is selected.

CCleaner cleaning only cookies

In the Applications tab, make sure that you select only Cookies for any browsers that the CCleaner has detected there as well.

CCleaner listing other browsers

Click Analyze to see what CCleaner will clean, and make sure that only cookies are listed. (If there are more, double-check the settings in the left pane, making sure to scroll down therein to see all the settings.)

Cookies to be cleaned by CCleaner

Once you're satisfied that it's going to clean what you want, click Run Cleaner.

Your cookies have been cleaned.

Well... most of your cookies.

Cookie exceptions

In CCleaner, click the Options icon on the left, and then the Cookies:

CCleaner delete / keep list

In the right column are domains for which CCleaner actually doesn't clean cookies. These are the cookies alluded to by that "Intelligently scan for cookies to keep?" setup option. By keeping cookies for these domains, your login state or user ID is preserved. Normally, if these cookies are removed, you'll need to login from scratch to these services each time, even if you say "remember me" when logging in. By preserving these cookies, you can preserve that state.

If after using your system for a while, after cleaning cookies, you decide that you want to add a domain to the exclusion list, it's fairly simple.

Run the Analyze step again, and then return to this Cookies section of the Options page.

Cookies listed for deletion

After cleaning cookies, you can see that I visited, where cookies from (to remember your name in the comment form), (to keep you from seeing the newsletter pop-up more than once every 180 days), (the password manager that I use) and (the advertising service used on the site) have been created.

Let's say that we want to allow cookies from to be preserved. Click in the list, click the "->" arrow: added to cookies to keep

You can see that "" has been added to the list of domains for which cookies will be kept.

Scheduling CCleaner to run nightly

Now that we've determined what settings we want in CCleaner, and have updated the list of domains for which cookies are not be deleted, the last remaining step is to configure CCleaner to run nightly.

Start by visiting CCleaner's Options page again and this time, click Advanced.

CCleaner's save all settings to INI file option

Make sure that "Save all settings to INI file" is checked.

You can actually close CCleaner now.

Click the Start orb, All Programs, Accessories, System Tools, Task Scheduler:

Task Scheduler in the Windows Start menu

Alternately, you can type "task scheduler" into the Windows search box.

In the resulting window, click Create Basic Task...:

Task Scheduler's create basic task link

This will fire up the Create Task Wizard.

In the first page, enter a name for the task:

Enter a name for this task

Click Next and you'll be asked to define a "trigger". In our case, this is time based and we want this to happen daily.

Setting a trigger: daily.

Click Next and you'll be asked specifically when each day you want this task to happen:

Scheduling when each day a task is to happen

You can choose any time that you like - it defaults to the current time. I tend to pick a time at night when I'm not likely to be using my computer.

Click Next and you'll be asked what to do. Choose Start a program and click Next again to define what program it is that we want to run.

Entering the program to run

Use the Browse... button to locate CCleaner.exe - it'll normally be in either "C:\Program Files\CCleaner\CCleaner.exe" or perhaps "C:\Program Files (x86)\CCleaner\CCleaner.exe".

Make sure to include /AUTO as an optional argument as shown. This tells CCleaner when it's run that it's being run automatically and should not display a user interface or wait for user input.

Click Next to be taken to the not-quite-final summary:

Basic task creation summary

Make certain to check "Open the properties dialog for this task when I click Finish", and click Finish.

Task properties

On this page, make sure to check "run with highest privileges" so that CCleaner can do its job.

Optionally, you can select "Run whether user is logged on", in which case, you'll be prompted for a password to be stored (encrypted) with the task.

Click OK.

Back in the Task Scheduler's main window, you can click "Task Scheduler Library" to see your new task in the list. Right-click the task and click Run to run it right away.

If you do, chances are that it'll be fairly quick, so you might not even notice it.

But you now have a nightly cookie cleanup.

CCleaner can do more

As you probably noticed, we bypassed many, many options in CCleaner that you could also choose to run at night. Simply choose those options as you go if you like.

I happen to run CCleaner nightly, not for cookie cleaning but rather to delete temporary files. I do this before my nightly backup so as to keep the backup that much smaller.

Finally, note that if you use CCleaner manually, you may want to go back and uncheck the "Save settings to INI file." With that checked, any changes that you make will be saved and therefore happen the next time CCleaner runs on its schedule.

Article C5085 - February 22, 2012 « »

Share this article with your friends:

Share this article on Facebook Tweet this article Email a link to this article
Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

February 22, 2012 9:49 AM

Also I like "cookienator" for those "evil" cookies.

Steve Mann
February 24, 2012 9:15 AM

You left out the obvious. The paranoia around cookies is WAY overblown.
Think of the unintended consequences from deleting cookies or blocking Google tracking. Without cookies, you likely have to re-enter data that cookies would have pointed to on the vendor's website. (They *have* your information, the cookies just point to it). If a search engine, such as Google, has no search history on you, then you will have all kinds of non-relevant advertising thrown at you. Face it, advertising is the fuel that keeps the internet running. If you allow cookies and search engine tracking, at least the advertising that you have to tolerate will be more likely to be relevant to you, based on your search or shopping habits.

February 24, 2012 9:42 AM

I don't know about Firefox, still less Chrome, though I've used both in my time. But using my browser of choice, Opera, I can right-click on any page and select the menu item "Edit Site Preferences" which enables to me to refuse or accept cookies, or delete them on exiting Opera.

I don't know whether other browsers have this feature, but I can't imagine why they wouldn't.

This seems to be simpler than the scheduled running of CCleaner, though I do use that from time to time. The more so as I prefer to hibernate overnight.

Steve Carsey
February 24, 2012 10:45 AM

I too used CCleaner for quite awhile, but it seemed to have something against my AVG free virus software, that is insisting on removing parts of it.

Of course that could be, and probably is, an operator problem rather then the program.

But WinUtilities, another free program is quite good, I think.

bob price
February 24, 2012 11:58 AM

I will never understand the paranoia about cookies. Some time ago, I deleted them all, and it took a full evening of re-establishing my web sites. if you are concerned about tracking and virus', then use other software. What is the realistic fear of first party cookies?

February 24, 2012 6:02 PM

In Yahoo, click on the Tools in the toolbar and in the pop-up there's a check box, about in the middle, to delete browsing history when you exit Yahoo. But that deletes the whole shebang, cookies and all.

Didn't I read something about Super Cookies a while back? Supposedly they were highly persistent, (very hard to get rid of) and did more serious stuff than regular cookies.

February 25, 2012 9:40 PM

In Google Chrome it is easy. Click on the Tool Bar - Wrench. Select -Tools, Clear Browser Data, Options - Under the Hood. On the "Under the Hood" page if you select the "Clear Browser Data" it has a box to delete all cookies along with other browser data. I leave this box empty when I delete the Browser Data. I prefer the "Content Settings", "All Cookies and Site Data". Here you can select and delete the cookies you do not want and keep the cookies you want.

Neal Watson
February 28, 2012 9:46 AM

Cookie paranoia is a mental health concern. Keep your hands off my cookies, they make life much easier.
On a related subject, I decided to try the free Advanced System Care - took me a day to recover after letting it do too much. However, it does have the best uninstaller ever. It will even remove an "unremovable" corrupt I Tunes installation.

Please comment on this and Soluto which now appears to be fully implemented - had my fasted ever boot on a heavily loaded HP desktop this morning. Didn't even have time to make my coffee!!

Comments on this entry are closed.

If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.

If you don't find your answer, head out to to ask your question.