Skip to content

Instantly share code, notes, and snippets.

@erkantaylan
Created June 24, 2015 12:30
Show Gist options
  • Save erkantaylan/c0a74e1789bd8902a1e2 to your computer and use it in GitHub Desktop.
Save erkantaylan/c0a74e1789bd8902a1e2 to your computer and use it in GitHub Desktop.
C#, self destroy, kendini silen exe
public void SelfDestroy()
{
string currentPath = Environment.CurrentDirectory;
string programName = Process.GetCurrentProcess().ProcessName;
string path = string.Format(@"{0}\{1}", currentPath, programName);
Process.Start(new ProcessStartInfo()
{
Arguments = string.Format("/C choice /C Y /N /D Y /T 3 & Del \"{0}\"", path),
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "cmd.exe"
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment