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

1 solution

This will be a short program ...

Start with the traditional "Hello World" program.

http://msdn.microsoft.com/en-us/library/aa288463%28v=vs.71%29.aspx[^]

Here's some background on the copy file API.

http://msdn.microsoft.com/en-us/library/system.io.file.copy%28v=vs.110%29.aspx[^]

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

C#
using System;

public class HomeWork
{
   public static void Main(string[] args)
   {
      if (args.Length == 2)
          System.IO.File.Copy(args[0], args[1]);
      else
          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