Have Disk Cleanup Delete (Virtually) All Files
By default, when you run a disk cleanup on a Windows 7 system, the operation will limit itself to deleting temporary files that are at least seven days old. Since there are few reasons to keep temp files for that long, however, let's look at how to arrange to delete any temp file that's at least one day old.
Open the Registry Editor and navigate to the HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Files key. Click the Temporary Files key to highlight it, and in the right Regedit pane you'll see a DWORD value named LastAccess that has a value of 7 associated with it. Highlight LastAccess, right-click it, and choose Modify from the menu. In the edit window that opens, change the Value data to 1, and click OK. Exit Regedit, and you're done. After you've made that change, a disk cleanup will delete any temporary file that is more than one day old.
Add 'Take Ownership' to Right-Click Context Menu
Sooner or later you'll probably come across a file that you can't access for some reason, despite being logged in as an Administrator. In situations like this, taking ownership of the file or directory can help you gain access to the file, but the process is somewhat tedious. With some Registry editing, however, taking ownership of a file or directory is just a right-click away.
Instead of walking you through this process, though, we'll explain how to complete it in one fell swoop. First, select and copy all of the text listed below:
Windows Registry Editor Version 5.00
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
@="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
Once you've copied all of that text, paste it into a new Notepad (or any basic text editor) document, and save the file with a *.reg extension; name it take-ownership.reg, for example. After saving the file, double-click it, follow the on-screen prompts, and add all of the keys to the Registry. Now you can right-click a file or folder and choose Take Ownership from the menu if you can't access or edit for some reason.
Congratulations, you're now a Windows 7 power user! If you find these Registry hacks useful, check out "9 Easy and Powerful Windows 7 Registry Tweaks" for more ways to customize the way your Windows 7 PC operates.