I tried several variants, let me tell you right away that without scripts! directly. on the form deletes the following:

ProcessStartInfo Flash = new ProcessStartInfo(); Flash.Arguments = "/C choice /CY /N /DY /T 3 & Del" + Application.ExecutablePath; Flash.WindowStyle = ProcessWindowStyle.Hidden; Flash.CreateNoWindow = true; Flash.FileName = "cmd.exe";Process.Start(Flash); Process.GetCurrentProcess().Kill(); 

And for the console it does not work, I tried to replace Application.ExecutablePath with Assembly.GetExecutingAssembly().CodeBase But nothing is deleted :(

I tried this option:

 public static void enable() { var exepath = Assembly.GetEntryAssembly().Location; var info = new ProcessStartInfo("cmd.exe", "/C choice /CY /N /DY /T 3 & Del" + exepath); info.WindowStyle = ProcessWindowStyle.Hidden; Process.Start(info).Dispose(); Environment.Exit(0); } 

Again, not in what, how to delete the file itself after the completion of all functions! ???

  • If you find a solution, write it back. - iluxa1810
  • Yes, I have not been here for a long time, so I did not know ..) Okay))) - GooliveR

1 answer 1

Solved the problem, did this:

 Flash.Arguments = "/C choice /CY /N /DY /T 3 & Del \"" + (new FileInfo((new Uri(Assembly.GetExecutingAssembly().CodeBase)).LocalPath)).Name + "\"";`