[Solved] How can I copy my program into a different place on my computer?


Copying programs is no different than copying any other file. You may use your Operational System’s tools to view and move files. You can do it with a graphic interface, example: Finder on Mac OSX, or Windows Explorer on Windows. Or, if you’d rather use command line tools use cp on Unix like systems or copy on Windows.

If you want to edit files from within your C# program you must the standard library to access the file system (files and folders). The documentation from Microsoft may help you:

How to: Get Information About Files, Folders, and Drives (C# Programming Guide)

How to: Copy, Delete, and Move Files and Folders (C# Programming Guide)

Minimal example extracted from link above:

    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);

3

solved How can I copy my program into a different place on my computer?