PC Review


Reply
Thread Tools Rate Thread

Automating map of network drives

 
 
John Doue
Guest
Posts: n/a
 
      9th Dec 2009
Hi,

I frequently need to map 3 partitions (d:, e: and c: in that order) of a
local network machine, respectively to m:, n:, and z: from my workstation.

Is there a way to automate this task via a batch file, just by
specifying the network name of the external machine?

Then, when I am finished, is it possible to disconnect those mapped
partitions via a batch file?

Thanks
--
John Doue
 
Reply With Quote
 
 
 
 
Pegasus [MVP]
Guest
Posts: n/a
 
      9th Dec 2009



"John Doue" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> Hi,
>
> I frequently need to map 3 partitions (d:, e: and c: in that order) of a
> local network machine, respectively to m:, n:, and z: from my workstation.
>
> Is there a way to automate this task via a batch file, just by specifying
> the network name of the external machine?
>
> Then, when I am finished, is it possible to disconnect those mapped
> partitions via a batch file?
>
> Thanks
> --
> John Doue


Try this:
@echo off
net use /persistent:no
net use X: \\PC1\Share1
net use Y: \\PC2\Share2
etc.

To disconnect the shares, use commands like this one:
net use X: /d

To see the many uses of the net.exe command, type this at the Command
Console:
net /?
net help
net use /?
net help use

 
Reply With Quote
 
Jean-Paul Darcis
Guest
Posts: n/a
 
      9th Dec 2009
Thanks, but now, I have a problem with the names of the partitions I
want to map. It appears there are naming restrictions to the mapped
partitions, which are applicable in a batch file and which are not using
explorer, tools, map.

Could you please share (pun intended) some light on those conventions?

Thanks
--
John Doue
 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a
 
      9th Dec 2009


"Jean-Paul Darcis" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> Thanks, but now, I have a problem with the names of the partitions I want
> to map. It appears there are naming restrictions to the mapped partitions,
> which are applicable in a batch file and which are not using explorer,
> tools, map.
>
> Could you please share (pun intended) some light on those conventions?
>
> Thanks
> --
> John Doue


I am not aware of any share naming restrictions. If a name is valid for a
folder then it is valid for a share. If you think otherwise, can you give an
example?

 
Reply With Quote
 
Shenan Stanley
Guest
Posts: n/a
 
      9th Dec 2009
Jean-Paul Darcis wrote:
> Thanks, but now, I have a problem with the names of the partitions I
> want to map. It appears there are naming restrictions to the mapped
> partitions, which are applicable in a batch file and which are not
> using explorer, tools, map.
>
> Could you please share (pun intended) some light on those
> conventions?
> Thanks


Use Quotation Marks around names with spaces/long names..

net use m: "\\myserver\this is my share" /persistent:no

--
Shenan Stanley
MS-MVP
--
How To Ask Questions The Smart Way
http://www.catb.org/~esr/faqs/smart-questions.html


 
Reply With Quote
 
John Doue
Guest
Posts: n/a
 
      10th Dec 2009

Pegasus [MVP] wrote:
>
>
> "Jean-Paul Darcis" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:(E-Mail Removed)...
>> Thanks, but now, I have a problem with the names of the partitions I
>> want to map. It appears there are naming restrictions to the mapped
>> partitions, which are applicable in a batch file and which are not
>> using explorer, tools, map.
>>
>> Could you please share (pun intended) some light on those conventions?
>>
>> Thanks
>> --
>> John Doue

>
> I am not aware of any share naming restrictions. If a name is valid for
> a folder then it is valid for a share. If you think otherwise, can you
> give an example?


Yes, I do think otherwise. I kept getting error 67 when trying this:

use net z: \\acer-or\acer-or (c)

where acer-or is the name of the machine on the network and acer-or (d)
the name of drive d: on that machine.

I was about to post a help request after stumbling for hours on this
error 67 and researching the Internet about it, when it occurred to me
that the name of the drive might be a problem since the command is typed
in what amounts to DOS remnants (and I go back to DOS times ...).

Since I am the network administrator, I changed the drive share name to
aceror(d) and my batch file worked instantly.

Shenan Stanley's post, which I read after I changed the shared drive's
name seems to confirm there is a convention.

To unify the name policy of the machines on the network, I decided to
rename all mapped drives according to the model aceror(d) (which is
explicit enough for me) to avoid such problems.

So it does look Shenan Stanley hit it on the nail. A pity this naming
convention (which may seem obvious enough once you put back this problem
in a broader context, but only then) is not clearly spelled out on the
MS pages I visited (granted, I may have missed some :-)). A pity too
that error 67 is kind of a pork barrel, not very helpful.

Thanks for your attention.

--
John Doue
 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a
 
      10th Dec 2009


"John Doue" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> Pegasus [MVP] wrote:
>>
>>
>> "Jean-Paul Darcis" <(E-Mail Removed)> schrieb im Newsbeitrag
>> news:(E-Mail Removed)...
>>> Thanks, but now, I have a problem with the names of the partitions I
>>> want to map. It appears there are naming restrictions to the mapped
>>> partitions, which are applicable in a batch file and which are not using
>>> explorer, tools, map.
>>>
>>> Could you please share (pun intended) some light on those conventions?
>>>
>>> Thanks
>>> --
>>> John Doue

>>
>> I am not aware of any share naming restrictions. If a name is valid for a
>> folder then it is valid for a share. If you think otherwise, can you give
>> an example?

>
> Yes, I do think otherwise. I kept getting error 67 when trying this:
>
> use net z: \\acer-or\acer-or (c)
>
> where acer-or is the name of the machine on the network and acer-or (d)
> the name of drive d: on that machine.
>
> I was about to post a help request after stumbling for hours on this error
> 67 and researching the Internet about it, when it occurred to me that the
> name of the drive might be a problem since the command is typed in what
> amounts to DOS remnants (and I go back to DOS times ...).
>
> Since I am the network administrator, I changed the drive share name to
> aceror(d) and my batch file worked instantly.
>
> Shenan Stanley's post, which I read after I changed the shared drive's
> name seems to confirm there is a convention.
>
> To unify the name policy of the machines on the network, I decided to
> rename all mapped drives according to the model aceror(d) (which is
> explicit enough for me) to avoid such problems.
>
> So it does look Shenan Stanley hit it on the nail. A pity this naming
> convention (which may seem obvious enough once you put back this problem
> in a broader context, but only then) is not clearly spelled out on the MS
> pages I visited (granted, I may have missed some :-)). A pity too that
> error 67 is kind of a pork barrel, not very helpful.
>
> Thanks for your attention.
>
> --
> John Doue


The convention of surrounding file or folder names with double quotes when
they have embedded spaces has been around ever since long file names became
permissible, i.e. since Windows 95 was introduced. That was almost 15 years
ago!

 
Reply With Quote
 
John Doue
Guest
Posts: n/a
 
      10th Dec 2009
Pegasus [MVP] wrote:
>
>
> "John Doue" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:(E-Mail Removed)...
>> Pegasus [MVP] wrote:
>>>
>>>
>>> "Jean-Paul Darcis" <(E-Mail Removed)> schrieb im Newsbeitrag
>>> news:(E-Mail Removed)...
>>>> Thanks, but now, I have a problem with the names of the partitions I
>>>> want to map. It appears there are naming restrictions to the mapped
>>>> partitions, which are applicable in a batch file and which are not
>>>> using explorer, tools, map.
>>>>
>>>> Could you please share (pun intended) some light on those conventions?
>>>>
>>>> Thanks
>>>> --
>>>> John Doue
>>>
>>> I am not aware of any share naming restrictions. If a name is valid
>>> for a folder then it is valid for a share. If you think otherwise,
>>> can you give an example?

>>
>> Yes, I do think otherwise. I kept getting error 67 when trying this:
>>
>> use net z: \\acer-or\acer-or (c)
>>
>> where acer-or is the name of the machine on the network and acer-or
>> (d) the name of drive d: on that machine.
>>
>> I was about to post a help request after stumbling for hours on this
>> error 67 and researching the Internet about it, when it occurred to me
>> that the name of the drive might be a problem since the command is
>> typed in what amounts to DOS remnants (and I go back to DOS times ...).
>>
>> Since I am the network administrator, I changed the drive share name
>> to aceror(d) and my batch file worked instantly.
>>
>> Shenan Stanley's post, which I read after I changed the shared drive's
>> name seems to confirm there is a convention.
>>
>> To unify the name policy of the machines on the network, I decided to
>> rename all mapped drives according to the model aceror(d) (which is
>> explicit enough for me) to avoid such problems.
>>
>> So it does look Shenan Stanley hit it on the nail. A pity this naming
>> convention (which may seem obvious enough once you put back this
>> problem in a broader context, but only then) is not clearly spelled
>> out on the MS pages I visited (granted, I may have missed some :-)). A
>> pity too that error 67 is kind of a pork barrel, not very helpful.
>>
>> Thanks for your attention.
>>
>> --
>> John Doue

>
> The convention of surrounding file or folder names with double quotes
> when they have embedded spaces has been around ever since long file
> names became permissible, i.e. since Windows 95 was introduced. That was
> almost 15 years ago!


I am not saying otherwise, on the contrary! I started 25 years ago and
when on the command line, this is still not embedded in my thinking! Ok,
this base of users is shrinking every day, but have mercy :-).

--
John Doue
 
Reply With Quote
 
boatman312
Guest
Posts: n/a
 
      10th Dec 2009
John Doue wrote:
> Pegasus [MVP] wrote:
>>
>>
>> "John Doue" <(E-Mail Removed)> schrieb im Newsbeitrag
>> news:(E-Mail Removed)...
>>> Pegasus [MVP] wrote:
>>>>
>>>>
>>>> "Jean-Paul Darcis" <(E-Mail Removed)> schrieb im Newsbeitrag
>>>> news:(E-Mail Removed)...
>>>>> Thanks, but now, I have a problem with the names of the partitions
>>>>> I want to map. It appears there are naming restrictions to the
>>>>> mapped partitions, which are applicable in a batch file and which
>>>>> are not using explorer, tools, map.
>>>>>
>>>>> Could you please share (pun intended) some light on those conventions?
>>>>>
>>>>> Thanks
>>>>> --
>>>>> John Doue
>>>>
>>>> I am not aware of any share naming restrictions. If a name is valid
>>>> for a folder then it is valid for a share. If you think otherwise,
>>>> can you give an example?
>>>
>>> Yes, I do think otherwise. I kept getting error 67 when trying this:
>>>
>>> use net z: \\acer-or\acer-or (c)
>>>
>>> where acer-or is the name of the machine on the network and acer-or
>>> (d) the name of drive d: on that machine.
>>>
>>> I was about to post a help request after stumbling for hours on this
>>> error 67 and researching the Internet about it, when it occurred to
>>> me that the name of the drive might be a problem since the command is
>>> typed in what amounts to DOS remnants (and I go back to DOS times ...).
>>>
>>> Since I am the network administrator, I changed the drive share name
>>> to aceror(d) and my batch file worked instantly.
>>>
>>> Shenan Stanley's post, which I read after I changed the shared
>>> drive's name seems to confirm there is a convention.
>>>
>>> To unify the name policy of the machines on the network, I decided to
>>> rename all mapped drives according to the model aceror(d) (which is
>>> explicit enough for me) to avoid such problems.
>>>
>>> So it does look Shenan Stanley hit it on the nail. A pity this naming
>>> convention (which may seem obvious enough once you put back this
>>> problem in a broader context, but only then) is not clearly spelled
>>> out on the MS pages I visited (granted, I may have missed some :-)).
>>> A pity too that error 67 is kind of a pork barrel, not very helpful.
>>>
>>> Thanks for your attention.
>>>
>>> --
>>> John Doue

>>
>> The convention of surrounding file or folder names with double quotes
>> when they have embedded spaces has been around ever since long file
>> names became permissible, i.e. since Windows 95 was introduced. That
>> was almost 15 years ago!

>
> I am not saying otherwise, on the contrary! I started 25 years ago and
> when on the command line, this is still not embedded in my thinking! Ok,
> this base of users is shrinking every day, but have mercy :-).
>

I'm jumping in a little late, but...

Isn't the syntax "net use //..." , not "use net //..."
 
Reply With Quote
 
John Doue
Guest
Posts: n/a
 
      10th Dec 2009

boatman312 wrote:
> John Doue wrote:
>> Pegasus [MVP] wrote:
>>>
>>>
>>> "John Doue" <(E-Mail Removed)> schrieb im Newsbeitrag
>>> news:(E-Mail Removed)...
>>>> Pegasus [MVP] wrote:
>>>>>
>>>>>
>>>>> "Jean-Paul Darcis" <(E-Mail Removed)> schrieb im Newsbeitrag
>>>>> news:(E-Mail Removed)...
>>>>>> Thanks, but now, I have a problem with the names of the partitions
>>>>>> I want to map. It appears there are naming restrictions to the
>>>>>> mapped partitions, which are applicable in a batch file and which
>>>>>> are not using explorer, tools, map.
>>>>>>
>>>>>> Could you please share (pun intended) some light on those
>>>>>> conventions?
>>>>>>
>>>>>> Thanks
>>>>>> --
>>>>>> John Doue
>>>>>
>>>>> I am not aware of any share naming restrictions. If a name is valid
>>>>> for a folder then it is valid for a share. If you think otherwise,
>>>>> can you give an example?
>>>>
>>>> Yes, I do think otherwise. I kept getting error 67 when trying this:
>>>>
>>>> use net z: \\acer-or\acer-or (c)
>>>>
>>>> where acer-or is the name of the machine on the network and acer-or
>>>> (d) the name of drive d: on that machine.
>>>>
>>>> I was about to post a help request after stumbling for hours on this
>>>> error 67 and researching the Internet about it, when it occurred to
>>>> me that the name of the drive might be a problem since the command
>>>> is typed in what amounts to DOS remnants (and I go back to DOS times
>>>> ...).
>>>>
>>>> Since I am the network administrator, I changed the drive share name
>>>> to aceror(d) and my batch file worked instantly.
>>>>
>>>> Shenan Stanley's post, which I read after I changed the shared
>>>> drive's name seems to confirm there is a convention.
>>>>
>>>> To unify the name policy of the machines on the network, I decided
>>>> to rename all mapped drives according to the model aceror(d) (which
>>>> is explicit enough for me) to avoid such problems.
>>>>
>>>> So it does look Shenan Stanley hit it on the nail. A pity this
>>>> naming convention (which may seem obvious enough once you put back
>>>> this problem in a broader context, but only then) is not clearly
>>>> spelled out on the MS pages I visited (granted, I may have missed
>>>> some :-)). A pity too that error 67 is kind of a pork barrel, not
>>>> very helpful.
>>>>
>>>> Thanks for your attention.
>>>>
>>>> --
>>>> John Doue
>>>
>>> The convention of surrounding file or folder names with double quotes
>>> when they have embedded spaces has been around ever since long file
>>> names became permissible, i.e. since Windows 95 was introduced. That
>>> was almost 15 years ago!

>>
>> I am not saying otherwise, on the contrary! I started 25 years ago and
>> when on the command line, this is still not embedded in my thinking!
>> Ok, this base of users is shrinking every day, but have mercy :-).
>>

> I'm jumping in a little late, but...
>
> Isn't the syntax "net use //..." , not "use net //..."


Of course! Just a typo, but worth correcting ...

--
John Doue
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
power point, videos, network drives, hard drives Michelle King Microsoft Powerpoint 8 6th Jun 2008 12:05 AM
Bad sectors/blocks - automating discovery of hard drives 'going bad' Phil Storage Devices 6 20th Feb 2007 08:09 PM
Drive Letter clash (mapped network drives vs physical drives) =?Utf-8?B?T2xpdmVyIFdoaXRlbWFu?= Windows XP General 4 4th Aug 2005 09:59 AM
Tarylynn - File Synchronizer - Local Drives, Network Drives, FTP to Server Mel Freeware 0 26th Jun 2005 03:29 PM
Enumerate all the drives including Mapped network drives on a serv =?Utf-8?B?UHJhZGVlcCBTdW5kYXJhbShNU0ZUKQ==?= Microsoft ASP .NET 2 26th Feb 2005 03:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:39 PM.