Looking for best practice for doing a “Net Use” in C#

对着背影说爱祢 提交于 2019-11-27 07:41:28

问题


I'd rather not have to resort to calling the command line.
I'm looking for code that can map/disconnect a drive, while also having exception handling.

Any ideas?


回答1:


Use P/Invoke and WNetAddConnection2
There should also be some wrappers out there to do some of the grunt work for you.
Google is your friend, as always.




回答2:


Here is an article for using a class for interfacing to the "map network drive" windows interface: C# Map Network Drive (API)



来源:https://stackoverflow.com/questions/8919/looking-for-best-practice-for-doing-a-net-use-in-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!