title: Copying a file and adding it to startup
body: <p>I'm creating an application where I'm copying the file to the user's appdata and then adding a registry key so that the file runs at startup.
  I get a URI exception while running it.
  Here's the fragment of the code that's giving me trouble..</p>
  
  <pre><code>RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\My_Application");
  if (rk != null)
  {
      //Do nothing as the program is already added to startup
  }
  else
  {
      string newpath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\My_Application\\" + "My_Application.exe";
      File.Copy(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase.ToString(), Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\My_Application\\" + "My_Application.exe");
      RegistryKey startup = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
      startup.SetValue("My_Application", "\"" + newpath);
  }
  </code></pre>