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! ???