First step to a cleaner and faster Windows – understand the Registry

(Please make sure you read all the pages linked under the Links section after you finish this article)Microsoft Windows Operating Systems starting from Windows 3.1. Before the registry was introduced, each application program used “ini” files to store their configuration. This was rather messy. Windows registry was first used only to store the OS core configurations only. Later this was changed and the application program configuration were also saved in Registry.

The first step in knowing the registry is of course seeing it. Registry is ordered hierarchically and consists of six main “hives” which get their names from API definitions :

HKEY_CURRENT_USER (HKCU)
HKEY_LOCAL_MACHINE (HKLM), HKEY_USERS (HKU)
HKEY_CURRENT_CONFIG, HKEY_PERFORMANCE_DATA
HKEY_DYN_DATA

each of these hives are further divided into sub-directories (sub-keys) in a hierarchical order. You can see these sub-keys when you click expand (+). These sub-keys contain other sub-keys and so on. This is shown in the above image.

Editing the registry

You can access registry by two methods, using RegEdit GUI tool or using “reg” command through Command Prompt. Since RegEdit method is easier, we will be discussing that method first. To open the graphical registry editor go to Start»RUN (WIN+R) , type “regedit” and press ENTER (You can find out more shortcuts in – Keyboard shortcuts for Windows). You can see the registry editor showing the two panes, one on the left showing a folder like structure (keys) and one on the right which will show the values saved in each key.

Regidtry with Hives/Keys values marked
Registry editor screen capture with Hives/Keys, Sub-keys and Values marked.

Using command prompt this process is not very straight forward. To open a command prompt, go to START»RUN (WIN+R), type cmd and press ENTER. In the command prompt type “reg /?“. ( Any command followed by /? will show a help for that particular command). You can start using command prompt for automating registry editing.

Screen capture of reg command help
reg /? will produce a small help for the command line registry editor.

Since we have two tools built-in to edit registry, we can use both of them to take a backup as well. Easier one first.

Editing the registry can be tricky. If you change some value to the wrong ones, your OS may get configured wrongly and may not necessarily be recoverable (something of a joke, but still need to warn some poor souls). Having said that it should be obvious to you that taking a backup of your registry is the best way to prevent future disasters. So we will first learn how to take a backup of the registry, even before we have learned how to edit it!

Taking a backup

Taking a backup of the registry will produce a “.reg” file, which,when opened is capable of writing the values stored in it to the registry. One thing to know is that System Restore will also create a backup of the whole registry, but this is not directly accessible.

Screen capture of opening a reg file
Opening a registration entry file prompts you to add it to the registry.

Here is the easy way. Go to registry editor “regedit” navigate tot he key you are about to edit (or not edit) and click on the KEY not not he value. You can either right click on the Key or Select File menu and then “Export”.

Screen capture of two ways to export/backup the registry
Select Export after clicking on a Key from Context or file menu.

Select the option to backup either the selected key or the whole registry. Give a name to the backup file and save. A good practice would be to give a date based name and add a bit that allows you to remember what settings you changed. You can double click on this file and restore it anytime you want. Please make sure you take a backup or a restore point before any editing.

Screen capture of options when saving a reg file
You can opt to save whether to save the whole registry or selected key

Since the easy way was fast, lets go to the slower and harder way. The command prompt command. reg command has got a command line switch which will allow you to take backup of the specified Key. the format is

reg export FULL_KEY_NAME FILE_NAME.reg

Screen capture of registry backup via reg command
Using reg command to export a registry Key - check out the crappy file name

It is pretty useless to copy each and every available command options here. Microsoft has got a really good documentation on reg command. You can read abut Registry commands and advanced techniques in the Links section. If you have any doubts or issues, post a comment and I will get back to you soon.

Good Practices

There are some easy ways to revert to a previous setting if you get screwed up changing a setting. Like when editing important files, make a copy first, name it to something like older_VALUENAME under the same Key itself and name the new Value as the original one. If anything goes wrong you can just rename the backup and save the day.

Registration entry file | Basic read on windows Registry | Recover from corrupt registry

View system files (super hidden) in Explorer

This is the first among a series of posts on administering Windows . It starts with how to see the files and folders that were hidden by Windows for some reason. The series is actually inspired from the one done by Samanathon on Starting your Day with a fresh Computer. He did a good job and I am a regular visitor of Saman’s Blog.

A Super Hidden or a Protected Syetem File is a file that is normally not shown in the Windows Explorer even if you have enabled Show Hidden files (Tools>>Folder Options>>View>>Show Hidden Files and Folders) in Windows Explorer). This is because if some of these files are deleted or changed Windows may encounter a fatal error. Some of such folders are :

  • C:Windowssystem32dllcache
  • System Volume Information – this is in all the drives
  • Recycler – which is also in all the drives

Super Hidden Files in C drive

So the first step involved is to make Windows show all the Super Hidden files. This can be done in two ways. One is directly through Windows Explorer Tools>>Folder Options and the other is through registry. So the former being easier and straight forward I’ll discuss it first.

1 . Through Windows Explorer

In Windows Explorer from Tools (Alt+T) menu take “View” tab in “Folder Options”.Make sure that you have selected Show Hidden Files and Folders and that you have unchecked Hide Protected operating system files options. Click Apply and then OK. This will enable you to see system files that had previously been hidden from your view.

Showing Super Hidden Files in Tools Menu

2 . Through Registry Editing

This is a little more complex.(It is recommended that you read the following posts before you go into the registry. Try this if you know Registry editing. Make a backup of the registry before you proceed.( The Introduction to Windows Registry , Know how to backup your registry )

Follow these steps..

1 . Run ( WIN+R ) regedit and open registry editor.

Super Hidden Dword in registry

Go to the Key HKEY_CURRENT_USERSoftwareMicrosoftWindows
CurrentVersionExplorerAdvanced
.

2 . In there you will see a Registry DWORD named ShowSuperHidden Make the value 1 instead of 0.

Dword Edit

3 . Now all you need to do is to restart Windows Explorer. to do so you can goto Start>>Shut Down and Click Cancel while holding down SHIFT+CTRL+ALT. Now press ALT+CTRL+DEL this will bring Task Manager. Take File>>New Task and type explorer and press Enter.

Now if you go to any drive you can see the previously Hidden files there. Note that you will still need to enable Show Hidden files option in Folder Option.

Change the default Drive Icons in Windows XP

You can change the default drive icons available in My Computer under Windows XP through the registry. Although it is done via registry the task is pretty simple and straight forward. (You can also use the Autorun method – please read that article if you prefer to do so)

Open registry editor ( WIN+R » regedit )

Navigate to the key
HKLMSoftwareMicrosoftWindowsCurrentVersionExplorerDriveIcons

Registry allows you to change the icons associated with each drive

Here you can see some sub keys with name as drive letters in you system.

Each one of them will have another sub key DefaultIcon . The Default string under DriveIcon keyDefault string value here contains the path to the icon used for that drive. Double Click on this and set the path of the icon you want to use.

Default icons for drives in XP xhanged to Vista ones.

This will change the default icon of that drive. Repeat it for other drives also. I don’t know any easier way, but if you know just post a comment and I will publish it here and link back to your blog.

How to prevent access to select drives using Registry

You may want to learn how to open, backup and edit registry which are explained in an easy to understand fashion in that page. There is another way using Disk Management to disable access to a drive. It is easier and much better than the method explained here. Yet another post explains how you can prevent others from copying data from your PC onto a USB storage device.

You can prevent access to any drive in Windows by creating a DWORD in registry. The advantage of this method is that, a single DWORD can disable access to drives selected by you. In order to try this, you have to open registry (try the introduction post to registry mentioned at the start) and browse to the KEY :

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer

Now rightclick on the right pane and select “New»DWORD (32-bit) Value” and name it NoViewOnDrive

Registry, creating a DWORD  to prevent drive access.
Browse to the specified key and create a new DWORD by rightclicking

The corresponding HKEY_LOCAL_MACHINE key :
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer

would probably allow you to apply a system wide restriction. I haven’t tried it yet.

From the following list, find the values of the drives you want to prevent access to. Now add these values together. For example, if you want to prevent access to D drive(8) and J drive(512) you will have 8+512 = 520.

A – 1, B – 2, C – 4, D – 8, E – 16, F – 32, G – 64, H – 128, I – 256, J – 512, K – 1024, L – 2048, M – 4096, N – 8192, O – 16384, P – 32768, Q – 65536, R – 131072, S – 262144, T – 524288, U – 1048576, V – 2097152, W – 4194304, X – 8388608, Y – 16777216, Z – 33554432, ALL – 67108863

If you need to disable access to more than one drive you may add the values corresponding to all those drives and set the value. That is if you need to disable D and F drives add 8 (D)+32 (F) = 40 to the key. Double Click on the NoViewOnDrive DWORD and after selecting Decimal radio button, paste this value.

Regedit, modifying a DWORD value for Drive access
In this picture I have selected D: drive and E:drive 8+16 = 24

After this step, you just have to close registry editor. The settings take effect immediately. (If this doesn’t take effect try restarting windows explorer) Next time you try to access one of the drives you will encounter and error message as shown below :

Drive access error
Error when trying to access a drive that has been blocked using registry.

Correction to the list files and folders from a directory to a file

I think you all remember OKTHEN, the one who told us all an easy way to list files and folders in a directory into a file through a context menu. He posted it as a comment. Well last day he commented on the post to correct some mistakes in the comment. Here is his new comment :

sorry i messed up a while back
cmd /c dir %1 /a /b >%1list.txt

would not only be unable to list files in folders with long file names but also it would not be able to output the list.txt to a folder with a long file name in order for it to work with long folder names, u need to use quotes around the %1’s also, if you use >> instead of > It will append to any existing list.txt in the folder you are catalogging instead of replacing the text file with a new one

if you want to append to a pre-existing list.txt when one already exists in the output folder then use:

cmd /c dir “%1? /a /b /s >>”%1?list.txt

or if you want it to replace a possibly pre-existing list.txt in the same output folder every time

cmd /c dir %1 /a /b >%1list.txt

————————————————
if you don’t wanna screw around in regedit
————————————————
then copy the following to a notepad document and then save it (where you can find it to click on) as listfiles.reg (NOTE make sure when u are in the save as dialog box in notepad you must use quotes around “listfiles.reg” otherwise it will loose its .reg extension and be useless)

[Start copy below this line]

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOTFoldershellMake FileList]

[HKEY_CLASSES_ROOTFoldershellMake FileListcommand]
@=”cmd /c dir ”%1” /a /b /s >>”%1”\list.txt”

[End copy above this line]

once the above is saved into a file called “listfiles.reg”
find the file in whatever folder you put it in
Right click on the file, left click on Merge
a box will ask are you sure? Yes/No click Yes

now you have a new command available “Make FileList”
when you right click any folder you will see this option

if you left click on the option it will then create a new file within that folder called list.txt which contains the contents of that folder as it was each time you told it to make a list

i realized awhile back i did not afford for long folder names but only now decided to correct it since i want to use almost the exact same thing to create a context deltree command (for quick erasure of files when i want it without using 1: shift+delete or 2: telling recycle bin to never be active keep files)

I am sorry that after his comment I didn’t check the method he mentioned. Actually his methos is easier. He has made it a lot more easier this time by telling a method to do it by using a reg file.

Hi OKTHEN,
thank you very much. BTW since I don’t know your email or website I can’t contact you. So please send me your contact details if you don’t mind. If you are interested in doing a guest post please contact me..

Find all recently used Wallpapers from your Registry

Windows saves the list of wallpapers ever used on the system in a registry Key.

HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersion
ExplorerWallpaperMRU

All those Registry Binary values here are the address to the images you used as wallpapers.

Wallpaper history binary value in registry

The last part in this binary makes no sense to me but I think this i information about the dimensions and style of the image.

Prevent copying of files to USB drive

There are times when you want to prevent others from copying your data but you still need them to be able to view it on your computer. The following tip will help you do exactly that.

As always it is the registry that comes to your rescue. Open the Registry Editor by typing regedit in RUN (WIN+R) dialog (more keyboard shortcuts). Go to th key

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies

Protect files from being copied to USB device, registry key

Create a new DWORD named WriteProtect (Right Click on right pane and select New»DWORD). Edit the value and make it 1. Just restart Windows explorer and you are done. Next time somebody tries to copy data to the external storage device they will see

Can't copy to Mass storage device error
If you need to copy something just make the stored value of WriteProtect to 0

**Tips : to restart Windows Explorer take Shutdown. Click Cancel while holding down SHIFT+CTRL+ALT, this will close Windows Explorer. Now take TASK MANAGER by pressing ALT+CTRL+DEL take File>>New Task>> [ explorer ] and press Enter. **

Clear the most recently run commands in Run Box from Registry

Windows has got the habit of saving almost anything you got your hands on, like recent run list, recent wallpaper, recent files etc.. Although some of these may be useful most of them are not. The recent RUN list, mentioned above, is saved in the Windows registry. (The recent Run list is useful but this is an example). If you take Start»RUN and type something you may perhaps note a drop down of the previous commands typed there.

Recent Run drop down

These commands that were previously typed are saved in the Registry. Goto Registry Editor by typing regedit in RUN dialog. Navigate to the following folder HKEY_CURRENT_USERSoftwareMicrosoftWindows
CurrentVersionExplorerRunMRU

Location of the List

Here you will find some regWords with values of Run lists and name as a,b,c,d.. there will also be an MRU List which saves the order in which the Run list is to be shown. Delete all the keys except default . Now restart Windows Explorer (press ALT+CTRL+SHIFT and click CANCEL button on Shutdown dialog and start explorer again through Task Manager). Now take the RUN box and the recent commands will not appear any more.

How to change the default wallpaper folder of Windows to your favourite one.

This is almost a follow up post of . So please read that post also.

The default Windows Wallpaper folder is %SystemRoot%\Web\Wallpaper where normally %SystemRoot% is C:\Windows . The location where the Desktop properties look for Wallpaper is saved in the Registry Key :

MyComputer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
\Currentversion

as a Multi String Value with a name WallpaperDir and having the the location of default wallpaper folder.

The Location of Windows default wallpaper folder saved in registry

All you need to change it to the folder you need by double clicking it and saving the new Location. Check out the new location I gave and the corresponding list shown as wallpapers.

The default folder changed to My Documents\My Picture\Hot

This is the value of my favorite folder. Now the change is immediate and you need not restart the Computer or Windows Explorer. Just Take Display Properties»Desktop

The new wallpaper shown on Desktop Properties

Cool(Hot) right? By the way its Kim Kardashian you can obtain the pictures from Kim Kardesian at Beach