Hide Specific Drives in Windows  

Page 2 of 2 FirstFirst 12

  1. Posts : 68,868
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #10

    sbh7600 said:
    Great stuff @Brink

    Have been looking for this method for a loooooong time
      My Computers


  2. Posts : 3
    10
       #11

    For example: To hide both the E (16) and F (32) drives, I would add 16 and 32 together from the table below, and enter 48.
    So, how do I decode that value programmatically?!
    I mean we have value 48 for (E + F) and we know it of our aspect!, how do I calculate the 48 to get the E & F volume?
    Note that not just 48 that would be 49 or 47 !!! So we cannot just minus the 48-32-16=0 to find the volumes !!
      My Computer


  3. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #12

    Hello @hamedn53,
    Welcome to TenForums.

    hamedn53 said:
    So, how do I decode that value programmatically?!
    I mean we have value 48 for (E + F) and we know it of our aspect!, how do I calculate the 48 to get the E & F volume?
    Note that not just 48 that would be 49 or 47 !!! So we cannot just minus the 48-32-16=0 to find the volumes !!
    I am NOT sure what you mean.

    Regardless of what the Drive Letter[s] are, there will be a SINGLE numeric value for them, as per the table in post 1 . . .

    Code:
    
    Drive Letter	Decimal Value Data
    Show all drives	0
    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
    Hide all drives	67108863

    So, for example, if you had Drives D + E + F, the value would be 56.

    I hope this helps.
      My Computer


  4. Posts : 3
    10
       #13

    Paul Black said:
    Hello @hamedn53,
    Welcome to TenForums.



    I am NOT sure what you mean.

    Regardless of what the Drive Letter[s] are, there will be a SINGLE numeric value for them, as per the table in post 1 . . .

    Code:
    
    Drive Letter	Decimal Value Data
    Show all drives	0
    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
    Hide all drives	67108863

    So, for example, if you had Drives D + E + F, the value would be 56.

    I hope this helps.
    Hey Paul, thanks for answering, but I do know that table values.
    I meant that; I wrote an app that shows the all mounted volumes on the system, and I also have a tree-view which lists all mounted volumes of the system that has checkbox for each item of the tree-view object.
    So, let's assume we did hide drives A+D+E with values of 1+8+16=25. I do know what 25 means by that table, but my app does not know how to handle that. I cannot write all the possibilities of that calculation, so I need an arithmetic algorithms to handle 25 into A,D,E volumes and so on. Am I pointed my opinion clearly?

    Hide Specific Drives in Windows-treeview-volumes.png
      My Computer


  5. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #14

    Hello @hamedn53,

    I know NOTHING about writing Apps, but can't you use an Array for the values, each being designated a specific number for EACH Drive Letter, like the Table, OR, set a Variable for EACH of the values?

    Because of what you are trying to achieve, you might be better off starting your own Thread for this, and just add the link to Post 1 in this Thread so that other members can see what you are referring to.

      My Computer


  6. Posts : 3
    10
       #15

    Paul Black said:
    Hello @hamedn53,

    I know NOTHING about writing Apps, but can't you use an Array for the values, each being designated a specific number for EACH Drive Letter, like the Table, OR, set a Variable for EACH of the values?

    Because of what you are trying to achieve, you might be better off starting your own Thread for this, and just add the link to Post 1 in this Thread so that other members can see what you are referring to.

    Actually I couldn't create an array. why? because there is not only 26 options! It is actually 26^26 (i think) mess or clutter!
    Yeah, thanks for the advise. That would be great idea! thanks again
      My Computer


  7. Posts : 15,480
    Windows10
       #16

    Long time since I did this but in one way is to use bit wise boolean logic.

    Trick is to convert integer into a binary string somehow.

    I am only suggesting the generic logic that might work NOT any specific algorithms, program or syntax

    Hope this gives you ideas.

    ----------------------------------------------------------------------------------------------------

    Following is from Python, other languages can probably do similar.Converting int to Binary

    To reveal the bits making up an integer number in Python, you can print a formatted string literal, which optionally lets you specify the number of leading zeros to display:
    >>>>>> print(f"{42:b}") # Print 42 in binary
    101010
    >>> print(f"{42:032b}") # Print 42 in binary on 32 zero-padded digits
    00000000000000000000000000101010


    rather than printing, you would create a text string somehow
    perhaps something like Num$= f"{42:026b}"


    Then you process text string.

    You would have array say L for letter
    L(1)=Z
    L(2)=Y
    ...
    L(26)=A

    Then you need a simple loop from 1 to 26 to look at each character in string in turn, and if 1 do actions, if 0 do nothing

    something like

    for i = 1 to 26
    if mid$(Num$, i, 1) = 1 then
    Letter = L(i)
    Do actions for variable Letter
    else
    endif
    next i
      My Computer


  8. Posts : 5,048
    Windows 10/11 Pro x64, Various Linux Builds, Networking, Storage, Cybersecurity Specialty.
       #17

    Hmm...

    Has anyone devised a simple utility to hide and show specified drives?

    Here's another way:

    How to hide an entire drive from prying eyes on Windows 10 | Windows Central

      My Computer


  9. Posts : 766
    Windows 7
       #18

    Paul Black said:
    I know NOTHING about writing Apps, but can't you use an Array for the values, each being designated a specific number for EACH Drive Letter, like the Table, OR, set a Variable for EACH of the values?
    Binary math using bitwise operators, makes this problem relatively simple.

    D, E, F are the 4th, 5th & 6th letters in the range of A to Z. They each have an ordinal (index) position relative to A.

    D minus A = 3 -> 2^3 = 8
    E minus A = 4 -> 2^4 = 16
    F minus A = 5 -> 2^5 = 32

    The binary shift-left operator allows us to express 2^N by shifting the number 1 (same in binary & decimal) N positions to the left. Therefore if we take the bitwise OR operation of each of the letter's ordinal positions relative to A, we get the correct decimal value.
    Code:
    (1 -shl 3) -bor (1 -shl 4) -bor (1 -shl 5) = 56

    To decode the bitmask in the other direction, you could treat it as a 26-bit array and perform a bitwise AND operation to compare each of the possible shifted values.

    With the ordinal position of the enabled bits, we can use that same position's offset from A (ASCII 65) to return a new letter.
    Code:
    for ($i = 1; $i -le 26; $i++) {
        if (( 56 -band (1 -shl $i) ) -gt 0) {
             [char](65 + $i)
        }
    }
    
    D
    E
    F
    - - - Updated - - -

    If you hate math, here's a PowerShell GUI for you.

    Hide Specific Drives in Windows-capture.png

    The script re-loads the current NoDrives value and marks which drives are already hidden. Checking the Volumes box will alternate between clearing all selections, or selecting all drives. Don't forget to logout to force Windows to update the Explorer views.

    The script will self-elevate if you're not running as Administrator. Yes, the flashing CMD windows are annoying but it all works in one script.

    NoDrives.bat
      My Computer


 

Tutorial Categories

Hide Specific Drives in Windows Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 09:20.
Find Us




Windows 10 Forums