[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2007-10-10
2
Medium Priority
?
2,130 Views
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
:logoff
Echo %username% "you are logged on else wher. Please log off at the other terminal before trying again"
pause

logoff
:continue

(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.

Thanks.

0
Comment
Question by:bestway_it
2 Comments
 
LVL 9

Accepted Solution

by:
MSE-dwells earned 150 total points
ID: 20048116
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.

0
 

Author Comment

by:bestway_it
ID: 20099345
Sorry I did not get back to you sooner.
Thanks for your help...
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

873 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