Home » Hiding Drive Letters

Hiding Drive Letters

September 24th, 2005 by Jim

Sometimes it is useful to hide or deny access to drive letters in My Computer and the Windows Explorer. This is often desired if you have a swap partition or scratch partition that you do not want in the way, or when a multi card reader creates drive letters you simply will not be using. Or maybe you just have something to hide… ๐Ÿ™‚

There are two ways to achieve this goal. The first method is easier and limited, while the second method is powerful and considerably more complicated.

Option 1 (Basic)
Recommended for users who are not comfortable with editing the Windows registry. Also recommended for users who would rather do it the easy way. ๐Ÿ˜‰

This method only hides the drive letters from the current user, e.g., the user logged in when the changes are made. If you need to hide drive letters from all users of the system, or if “hiding” is not good enough and you need to deny access, please scroll down and read Option 2 instead.

What you will need

  1. Administrator privileges
  2. Tweak UI (distributed with the Microsoft PowerToys for Windows XP)

How to use Tweak UI

  1. Login as an administrator.
  2. Run Tweak UI.
  3. Navigate to My Computer » Drives. Note: This step refers to Tweak UI, not Windows.
  4. You should see a list of drive letters from A to Z on the right side. Uncheck any drive letters you do not want to see anymore. Note: You should not uncheck drive letters with a red question mark on them! These are not currently in use, and you should leave them checked so they will be available for any new hardware you plugin later.
Tweak UI ร‚ยป My Computer ร‚ยป Drives

If you did everything correctly, the drive letters you wanted to hide will no longer be listed in My Computer or the Windows Explorer. Programs and dialogs that internally use the Windows Explorer will also be affected.

Option 2 (Advanced)
Recommended for users who need to hide the same drive letters on multiple computers, or would like to know what Tweak UI is doing. Warning: This method hides the drive letters from all users!

What you will need

  1. Administrator privileges
  2. Windows Registry Editor (regedit.exe)
  3. Possibly a calculator supporting the square and square root functions.

Editing the registry

  1. Login as an administrator.
  2. Open the Registry Editor (Windows Key + R; Run “regedit.exe”).
  3. Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\policies\Explorer
    Note: You may need to create the Explorer key.
  4. From the Registry Editor menu, select Edit » New » DWORD Value to create a new DWORD named NoDrives. The value will be calculated by adding together unique values that represent individual drive letters. Use Table 1 or f(x) to determine the identifying value of a drive letter.

    f(x) = 2 ^ g(x)
    g(x) = [position in alphabet, with A = 0, B = 1, …]

    Note: f(x) is a binary multiplier.

  5. Determine the value of each drive letter you need to hide. Note: The values will have an integer square root. If the square root results in a decimal, you need to recalculate f(x) for that drive letter!
  6. Add the f(x) values together to get a single value. Note: The result will be an integer that is divisible by two. If your result is not a multiple of two, you need to check your work in the previous steps.
  7. Set the NoDrives registry key (created in step 4) to the value calculated in step 6.
  8. Logout and login again, or restart the Windows Explorer (“explorer.exe”) from the Task Manager.

Note 1: To deny access to drive letters, repeat the above steps using the name NoViewOnDrive for the DWORD in step 4.

Note 2: You can alternatively perform the above steps on a per-user basis by editing HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer on step 3 instead. Please be aware that HKEY_LOCAL_MACHINE overrides HKEY_CURRENT_USER, so the two approaches (system-wide or per-user) are mutually exclusive.

Example

You purchased a multi card reader, and when you plugged it in for the first time, it made four new drive letters. You do not own any SD or CompactFlash cards, and you determined that you need to hide drive letters G and J.

  1. Look up the values for G and J in Table 1, which are (decimal) 64 and 512 respectively.
  2. 64 + 512 = 576. The registry value NoDrives from step 4 should be set to 576 (decimal).

If you did everything correctly, the drive letters you wanted to hide will no longer be listed in My Computer or the Windows Explorer. Programs and dialogs that internally use the Windows Explorer will also be affected.

Table 1
f(x) for all drive letters.
Drive
Letter
Alphabet
Position
f(x)
(decimal)
f(x)
(hexadecimal)
f(x)
(binary)
A 0 1 0x00000001 00000000 00000000 00000000 00000001
B 1 2 0x00000002 00000000 00000000 00000000 00000010
C 2 4 0x00000004 00000000 00000000 00000000 00000100
D 3 8 0x00000008 00000000 00000000 00000000 00001000
E 4 16 0x00000010 00000000 00000000 00000000 00010000
F 5 32 0x00000020 00000000 00000000 00000000 00100000
G 6 64 0x00000040 00000000 00000000 00000000 01000000
H 7 128 0x00000080 00000000 00000000 00000000 10000000
I 8 256 0x00000100 00000000 00000000 00000001 00000000
J 9 512 0x00000200 00000000 00000000 00000010 00000000
K 10 1024 0x00000400 00000000 00000000 00000100 00000000
L 11 2048 0x00000800 00000000 00000000 00001000 00000000
M 12 4096 0x00001000 00000000 00000000 00010000 00000000
N 13 8192 0x00002000 00000000 00000000 00100000 00000000
O 14 16384 0x00004000 00000000 00000000 01000000 00000000
P 15 32768 0x00008000 00000000 00000000 10000000 00000000
Q 16 65536 0x00010000 00000000 00000001 00000000 00000000
R 17 131072 0x00020000 00000000 00000010 00000000 00000000
S 18 262144 0x00040000 00000000 00000100 00000000 00000000
T 19 524288 0x00080000 00000000 00001000 00000000 00000000
U 20 1048576 0x00100000 00000000 00010000 00000000 00000000
V 21 2097152 0x00200000 00000000 00100000 00000000 00000000
W 22 4194304 0x00400000 00000000 01000000 00000000 00000000
X 23 8388608 0x00800000 00000000 10000000 00000000 00000000
Y 24 16777216 0x01000000 00000001 00000000 00000000 00000000
Z 25 33554432 0x02000000 00000010 00000000 00000000 00000000

Leave a Reply »

Revision History

2006.02.03 Corrected the formula for f(x). Thank you, rabidpulse!
2005.10.12 Added this Revision History block.
2005.09.24 Initial revision.

Disclaimer

I do not offer a warranty or guarantee for anything described in this article. All of my tips are based on personal and professional experience, but you are solely responsible for your own actions. Please backup your data first, and exercise extreme caution when using this information, which could leave your machine unbootable, unstable, or simply unusable!

5 Responses to “Hiding Drive Letters”

  1. NovRain Says:

    Very interesting development. You must have a lot of free time on your hands.

  2. Jim Says:

    Haha, free time? Not exactly, but thanks for the words of encouragement. ๐Ÿ™‚

    I try my best to give clear and helpful instructions, but I am fairly new to blogging and I am still figuring out what works best. All of these articles are written by me, and their lengths are determined by the frequency that people ask “How do I…?” and/or the complexity of the topic itself.

    I wrote this one during Hurricane Rita, so I had a little more time than usual… ๐Ÿ˜ฏ

  3. NovRain Says:

    Naw…good job bro. Keep up the good work.

    “Well man, I just thought it was an all out brawl”

  4. rabidpulse Says:

    Just a suggestion, but your formula breakdown is wrong. It should be f(x)=2^g(x). The table is right, but if you square g(x) you get wrong values. Thanks for the info on how to hide drives it was a big help.

  5. Jim Says:

    I cannot believe I missed that, but thanks for letting me know!:oops: It is now correct in the article, too.