Windows 域中的网络共享
我在 Windows 域中有两台计算机。
其中一台运行一个应用程序,该应用程序可以访问另一台计算机上的网络共享,因为它是通过域帐户授权的。但是,在新启动的配置中,对共享的访问失败。
用户的解决方法是单击 Windows 资源管理器中的共享,从那时起,应用程序就可以访问它。
Windows 命令提示符 (cmd) 也存在同样的问题:dir s:
(s 是共享驱动器盘符)在您在资源管理器中单击该驱动器之前会失败。
是否有任何系统调用可以调用来从我的应用程序以编程方式“打开”网络共享,而不是在资源管理器中单击它?
谢谢
I have two computers in a Windows Domain.
One of them runs an application that accesses network shares on the other, as it is authorized via a Domain account. However, in a freshly booted configuration, the access on the shares fails.
The user workaround is to click the share in Windows Explorer and from that time on, it is accessible by the application.
The Windows Command Prompt (cmd) has the same problem: dir s:
(s being the shared drive letter) fails until you click the drive in Explorer.
Is there any system call I can invoke to "open" the network share programatically from my application, rather than clicking it in Explorer?
Thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

连接和重新连接网络共享有点棘手,Windows 有时会错过恢复从一个网络漫游到另一个网络的笔记本电脑的连接。
我在一些 BAT 文件中使用了这个小策略...
如果当前用户名存在并且在域或服务器中具有相同的密码,或者如果客户端域位于域控制器的信任列表中,则访问是允许。如果没有,您将需要在命令中指定用户名,并且系统将提示您输入密码(在 BAT 文件中指定密码是一个非常糟糕的主意),
请参阅 http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_use.mspx?mfr=true 了解更多信息
connecting and reconnecting a network share is somewhat tricky, windows sometimes misses to restore connections from laptops roaming from one net to another.
I use this little strategy in some of my BAT files...
if the current user name exists and have the same password in the domain or in the server, or if the client domain is in the trust list of the domain controller, access is allowed. If not, you will need to specify the username in the command and will be prompted for the password (specifying the password in the BAT file is a very bad idea)
see http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_use.mspx?mfr=true for more information