Win32 drive mapping... aka "net use"

Lucas Machado LMachado1 at
Sat Mar 5 18:46:57 CET 2005

Alex Martelli wrote:

> import win32net
> win32net.NetUseAdd(None,1,{'remote':r'\\server\share','local':'K:'})
> is an example (not all that easy to fathom from the docs, but I
> found it out with a little help from the docs, a little from MSDN,
> and a little experimentation).

I looked through the MSDN and was not able to find much information on
how to properly use the NetUseAdd function.  I searched for the
function and looked through the results but all it showed was some data
structure, but i was actually looking for a list of all possible
arguments and which arguments were/were not required.

my problem with the above NetUseAdd example is that I would rather not
have to specify a device.  In the script I am writing the user may
choose to map multiple shares so I need to be able to map to the next
available device:

net use * \\some_server\share_name

instead of:

net use k: \\server\share

Thanks for the help in advance.  Also, if anyone could provide a link
to good windows api docs for python that would be great.

--Lucas Machado

More information about the Python-list mailing list