mapping a drive using a batch file BUT hide the mapped drive within windows explorer

Posted on 2007-10-10
Last Modified: 2008-01-09
I have written a batch file as below:
net use U: \\<serveripaddress>\%username%$
if not exist U: goto logoff
if exist U: go to continue
Echo %username% "you are logged on else wher. Please log off at the other terminal before trying again"


(rest of script).

I am assuming that %username%$ is the name of the 2nd share ie bloggs$ that I have created and the above batch file is looking to use this share to map. The first share name would be bloggs.

Please can you tell me where I am going wrong in my batch file. I want to be able to map a drive but hide it when the user goes into windows explorer or my computer.


Question by:bestway_it
    LVL 9

    Accepted Solution

    The $ symbol hides shares from the browser, it does not hide drives that are mapped to those shares.  The following registry tweak -

    - HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDrives [REG_DWORD]

    ... will do as you ask.  It uses a 32-bit number to define local and network drive visibility for each logical drive in the computer.  The lower 26 bits of the 32-bit word correspond to drive letters A through Z.  Drives are visible when their corresponding bit is set to 0 and hidden when set to 1, e.g. to hide drives A & U -

    A = 1st letter -- the 1st low-order bit is bit 0 (value = 1) -- to hide drive A, we add a 1 to our existing value

    U = 21st letter -- the 21st low-order bit is bit 20 (value = 524288) -- so to hide drive U, we add 524288

    ... this results in 1 (A drive) + 524288 (U drive) = 524289

    In your case, you'd need to enter simply 524288.

    NOTE - You'll need to restart Windows for the change to take effect.


    Author Comment

    Sorry I did not get back to you sooner.
    Thanks for your help...

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
    I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now