Click here to Skip to main content
15,917,859 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
It needs to b a console application

1 solution

This will be a short program ...

Start with the traditional "Hello World" program.[^]

Here's some background on the copy file API.[^]

Put these two together, you'll end up with something like:

using System;

public class HomeWork
   public static void Main(string[] args)
      if (args.Length == 2)
          System.IO.File.Copy(args[0], args[1]);
          Console.WriteLine("Expected two file names.");

Compile the program. Open a command window and run it. Include the name of the file you want to copy. Something like ...

HomeWork "\\machine\path\to\file" "."
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900