Delete IE7 History From the Command Line

When cloning a computer running Windows XP, 2003, Vista or 2008, one of the tasks that you should perform before running SYSPREP is to delete the Internet Explorer 6 history, stored passwords, offline files and cookies. Same goes when preparing a computer for transfer to another user, or simply requiring that previous user data be deleted.

Through the usual IE GUI

One method of performing this task is by using the IE7 GUI.

Open Internet Explorer, and from the Tools menu, open Internet Options.

Go to the General tab, and in the Browser History section, click on the Delete button.

In the Delete Browser History window, click one of the following buttons, based upon your requirements:

Temporary Internet Files > Delete files – To delete copies of web pages, images, and media that  are saved for faster viewing.

Cookies > Delete cookies – To delete cookies, which are files stored on your computer by websites to save preferences such as login information.

History > Delete history – To delete the history of the websites you have visited.

Form data > Delete forms – To delete all the saved information that you have typed into forms.

Passwords > Delete passwords – To delete all the passwords that are automatically filled in when you log on to a website you’ve previously visited.

Delete all – To delete all of the above in one operation.

By using a command

However, sometimes it is much easier to simply run a command line command or batch file to perform the same tasks. I use such a batch file and place it in one of my “special scripts” folder, where I store all my cool stuff. All I have to do is simply double-click on it, and bingo, history, passwords, cookies and offline files are deleted.

Here are the independent commands you can use. Go to Start > Run. Type CMD and press Enter. In the Command Prompt window, type (or copy and paste) the following commands, and press Enter:

Delete Temporary Internet Files

Delete Cookies

Delete History

Delete Form Data

Delete Stored Passwords

Delete All

Delete All with the “Also delete files and settings stored by add-ons” options selected

Now it seems that the interesting bit is that you can combine the numbers to get 2 or more functions at the same time. For example, type:

This will delete the files (+8) and history (+1) in one step. You can incorporate this into a logoff script, and assign it to users by using Group Policy (GPO).

Creating a shortcut

You can create a shortcut and place it on your desktop or Quick Launch toolbar.

Right-click on an empty spot on your desktop, select New > Shortcut.

In the Create Shortcut window, paste one of the above commands.

Give it an appropriate name, and press Finish.

You can also change the shortcut icon by right-clicking on it and selecting Properties. Next press the Change Icon button.

You can use the following file to find some interesting icons for the shortcut:

Creating a batch file

You can also create a batch file that you can simply run by double-clicking on it. Save the following text as a .BAT file:

Second example uses e different approach, but it’s also worth noting:

Recent Windows Server 2008 Forum threads

Got a question? Post it on our Windows Server 2008 forums!

Related Topics:

  • Windows Server 2008

    Don't have a login but want to join the conversation? Sign up for a Petri Account