Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何将程序复制到计算机上的其他位置?_C#_Download_Copy - Fatal编程技术网

C# 如何将程序复制到计算机上的其他位置?

C# 如何将程序复制到计算机上的其他位置?,c#,download,copy,C#,Download,Copy,如何将程序从源代码复制到其他文件夹(使用C代码) 附:我的下载文件夹的C#来源是什么 我不知道该怎么做:/ 感谢您的帮助:-)复制程序与复制任何其他文件没有什么不同。您可以使用操作系统的工具查看和移动文件。您可以使用图形界面来完成此操作,例如:MacOSX上的Finder或Windows上的Windows Explorer。或者,如果您更愿意使用命令行工具,请在类Unix系统上使用cp,或者在Windows上使用copy 如果要编辑C#程序中的文件,必须使用标准库才能访问文件系统(文件和文件夹)

如何将程序从源代码复制到其他文件夹(使用C代码)

附:我的下载文件夹的C#来源是什么

我不知道该怎么做:/


感谢您的帮助:-)

复制程序与复制任何其他文件没有什么不同。您可以使用操作系统的工具查看和移动文件。您可以使用图形界面来完成此操作,例如:MacOSX上的Finder或Windows上的Windows Explorer。或者,如果您更愿意使用命令行工具,请在类Unix系统上使用
cp
,或者在Windows上使用
copy

如果要编辑C#程序中的文件,必须使用标准库才能访问文件系统(文件和文件夹)。Microsoft提供的文档可能会帮助您:

从上面的链接中提取的最小示例:

    string fileName = "test.txt";
    string sourcePath = @"C:\Users\Public\TestFolder";
    string targetPath =  @"C:\Users\Public\TestFolder\SubDir";

    // Use Path class to manipulate file and directory paths. 
    string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
    string destFile = System.IO.Path.Combine(targetPath, fileName);

    // To copy a file to another location and  
    // overwrite the destination file if it already exists.
    System.IO.File.Copy(sourceFile, destFile, true);

谷歌永远是伟大的第一步。@eddie_猫我搜索过了,但什么也没找到我不相信你。你在找什么?我希望它是由我的程序来完成的,我不想自己去做。我问的代码是谁做的。这甚至没有试图以编程的方式回答这个问题。我误解了你的问题。虽然我对C#不太流利,但我正在更新我对微软文档的回答,比如如何做到这一点。