从远程计算机复制文件 [英] Copy a File from a remote computer

查看:90
本文介绍了从远程计算机复制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试访问远程计算机,登录到该计算机,然后将文件从该计算机复制到我的计算机.

File.Copy(x,y)无效,因为没有登录凭据.

无论如何,是否可以使用ip地址和凭据登录到此计算机,并使用流读取器读取文件并将其复制到我的本地计算机?

谢谢

I am trying to access a remote computer, login to it and copy a file from that computer to mine.

File.Copy(x,y) doesn''t work because there are no log in credentials.

Is there anyway to login to this computer using the ip address and credentials and use a streamreader to read the file and copy it to my local computer?

Thanks

推荐答案

可以共享驱动器而不需要凭据,但这必须由系统管理员来完成.
The drive could be shared without the need for credentials, but that would have to be done by the system''s administrator.


您可以使用Win32函数 WNetAddConnection2 [ ^ ]或 WNetAddConnection3 [ WNetCancelConnection2释放连接即可 [ ^ ].
You can use the Win32 functions WNetAddConnection2[^] or WNetAddConnection3[^]to make the connection to the remote resource (\\servername\sharename). Just remember to release the connection when you''re done with it, with WNetCancelConnection2[^].


这篇关于从远程计算机复制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆