You are here

Windows 7: Changing the location of system temporary files and browser caches

Submitted by Druss on Wed, 2012-02-15 01:11

My windows machine is running off a bum drive and seeing as to how HDD prices are temporarily ridiculously high at the moment, I've decided to attempt a few workarounds to see if I can continue to use this erratically faulty drive for a couple of more months. The issue with the drive is in itself unknown. It just locks up suddenly with the HDD LED continuously on. Windows continues to be active for a while, but not terribly responsive. Sometimes, the issue sorts itself out after a while. Other times, the system reboots.

I'm trying this to see if this is a bad sector(s) (that's so 1990s though) issue with the drive and am trying to minimise the writes to my system (C:) partition. Consequently, I'm moving all my system and browser temporary and cache directories to a different partition (on the same drive). That said, this is usually done in order to move said directories to a different partition on a different drive in a bid to improve performance.

Here we go:

  1. Open up Windows explorer and navigate to the partition where you'd like to store your temporary files and browser cache(s).
  2. Create two folders named "temp" and "cache".
  3. Within the "cache" folder, create one folder for each of the browsers whose caches you want to relocate. In my case, I created three of them, namely "chrome", "ff" and "opera".
  4. To move the Windows temporary directory, right-click on "My Computer" in the Start Menu or elsewhere and click on properties.
  5. Click on the "Advanced Settings" link on the top-left.
  6. Click on the "Advanced" tab at the top of the resulting dialog.
  7. Click on the "Environment Variables" button at the bottom.
  8. In the ensuing window, you should see two different areas; one pertaining to "User variables" and the other to "System Variables". Both of these locations should have entries titled TEMP and TMP which point to the current temporary folder.
  9. You can double-click each of these four entries and point it to the new location at say, G:\temp. In my case, I just deleted the TEMP and TMP user variables as I'm content with the system-wide options (seeing as to how I'm the only one who uses this machine).
  10. Click on OK on each of the dialogs to save our changes.

For Google Chrome:

  1. Right-click on the short-cut button that you use to launch the browser and click on "Properties". If your short-cut is pinned to the taskbar, you might need to right-click on the taskbar icon, right-click on the "Google Chrome" entry in the pop-up and then click "Properties".
  2. In the ensuing dialog, add the following to the end of the "Target" textfield:
    --disk-cache-dir=”g:\cache\chrome” --disk-cache-size=314572800
    This should set the cache to the newly created cache\chrome folder and also set the cache size to 300MB (300 * 1024 * 1024).
  3. Click on OK to save our changes.

For Firefox:

  1. Open Firefox and visit the address "about:config". If there's a warning about being careful, read it and accept it.
  2. In the resulting page, type "parent" in the "Filter" bar and look for any preferences named browser.cache.disk.parent_directory. If you see it, double-click this entry.
  3. If you do not see such an entry, right click within the page and click on "New" and then "String". Enter browser.cache.disk.parent_directory as the "Preference name".
  4. For the "Value", enter the directory location, which in my case is G:\cache\ff.
  5. Click on OK to save our changes and restart Firefox.

Finally, for Opera:

  1. Open Opera and visit the address "opera:config".
  2. In the resulting page, type "cache directory" in the "Quick find" box which should bring up two options titled Cache Directory4 and Operator Cache Directory4. We are only concerned with the first entry.
  3. In the textfield associated with Cache Directory4, enter the directory location, which in my case is G:\cache\opera.
  4. Click on "Save" to save our changes and restart Opera.

These steps did the trick for me. Hopefully, this should alleviate some of my HDD troubles. I hope that this helps somebody out there too. If it does, please leave a note - I like having halos floating above my head ;) (Please also leave a note if it doesn't!)