Kod:
using System.Diagnostics;
Kod:
void programi_Sil()
{
Process islem = new Process();
ProcessStartInfo islem_Bilgisi = new ProcessStartInfo("cmd.exe", "/C del \"" + Application.ExecutablePath + "\"");
islem_Bilgisi.CreateNoWindow = true;
islem_Bilgisi.UseShellExecute = false;
islem = Process.Start(islem_Bilgisi);
islem.Close();
}
Kod:
void programi_sil2()
{
Process.Start(new ProcessStartInfo()
{
Arguments = "/C del \"" + Application.ExecutablePath + "\"",
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "cmd.exe"
});
}
Form Kapatma eventlerinden herhangi birine şu kodu ekleyin
Kod:
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
programi_Sil();
// veya programi_sil2();
}