简体   繁体   English

如何在C#(windows app)中将文件从本地系统复制到其他系统?

[英]How to copy file from local system to other system in C# (windows app)?

I need to load help files from my windows C# application and move/copy to other system (to its local drive). 我需要从我的Windows C#应用程序加载帮助文件并移动/复制到其他系统(到其本地驱动器)。 Application (same C# windows application) on the local system will use it for help. 本地系统上的应用程序(相同的C#windows应用程序)将使用它来提供帮助。

What needs to be done to accomplish this? 要做到这一点需要做些什么?

I understand File.Copy() but i don't know, will it hold for remote system also? 我理解File.Copy()但我不知道,它是否也适用于远程系统?

File.Copy(
    @"C:\localpath\file.hlp", 
    @"\\remotemachinename\localpathonremotemachine\file.hlp");

Or something along those lines... the second value is a UNC path. 或者沿着这些线的东西......第二个值是UNC路径。

And in case the target location needs a login and password, the following answer is applicable: Copy file to remote computer using remote admin credentials (Thanks to Carlos Rendon for finding it). 如果目标位置需要登录名和密码,则以下答案适用: 使用远程管理凭据将文件复制到远程计算机 (感谢Carlos Rendon找到它)。

File.Copy() Copies an existing file to a new file. File.Copy()将现有文件复制到新文件。 The target can be a remote share (UNC). 目标可以是远程共享(UNC)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用C#(在同一LAN网络中连接)将文件从远程系统复制到本地系统? - How to copy file from remote system to local system using C# (connected in same LAN network)? 如何将文件从 UNC-share 复制到本地系统? - How to copy file from UNC-share to local system? 如何使用Windows C#应用程序的系统字体设置 - How to use system font settings for a Windows C# app C#如何将文件从raspberry pi 3B +复制到windows本地文件夹 - C# how to copy file from raspberry pi 3B+ to windows local folder 在本地系统帐户下的 C# windows 服务中打印 PDF 文件 - printing a PDF file in a C# windows service under Local system account C#权限问题导致无法从以本地系统帐户身份运行的Windows服务创建文件夹。 - C# Privilege issues creating folders from Windows service running as Local System account. 如何使用C#将Windows系统时钟设置为正确的本地时间? - How do I set the Windows system clock to the correct local time using C#? 如何在 C# 中获取 Windows\system32\config\systemprofile\AppData\Local\ 文件夹路径? - How to get Windows\system32\config\systemprofile\AppData\Local\ folder path in C#? 如何将文件从服务器复制到客户端系统? - How to copy a file from server to client system? 如何在C#中将文件从一个文件夹复制到另一个文件夹 - How to copy a file from one folder to other in c#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM