What is the best way to map windows drives using Python?

后端 未结 7 1630
孤城傲影
孤城傲影 2020-11-28 05:08

What is the best way to map a network share to a windows drive using Python? This share also requires a username and password.

7条回答
  •  甜味超标
    2020-11-28 05:29

    I had trouble getting this line to work:

    win32wnet.WNetAddConnection2(win32netcon.RESOURCETYPE_DISK, drive, networkPath, None, user, password)

    But was successful with this:

    win32wnet.WNetAddConnection2(1, 'Z:', r'\UNCpath\share', None, 'login', 'password')

提交回复
热议问题