string starupPath = Application.ExecutablePath; RegistryKey loca = Registry.LocalMachine;RegistryKey run = loca.CreateSubKey( @" SOFTWAREMicrosoftWindowsCurrentVersionRun " ); try ... {run.SetValue("WinForm",starupPath);MessageBox.Show(" 注册表添加成功!!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);loca.Close();} catch (Exception ee) ... {MessageBox.Show(ee.Message.ToString(),"提示",MessageBoxButtons.OK,MessageBoxIcon.Error );}