What is the best way to map a network share to a windows drive using Python? This share also requires a username and password.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Assuming that you import necessary libraries, This was a part of an RPC server where the client requested the server to map a drive locally...
================Check the white spaces from here, these were a part of a function============
I don't have a server to test with here at home, but maybe you could simply use the standard library's subprocess module to execute the appropriate NET USE command?
Looking at NET HELP USE from a windows command prompt, looks like you should be able to enter both the password and user id in the net use command to map the drive.
A quick test in the interpreter of a bare net use command w/o the mapping stuff: