Batchfile – Selfdelete

Here is a simple code how to delete a batchfile after running. Mostly used to erase traces and not having so much trash on your filesystem

@echo off
cmd /q /c del %0
exit
  • @echo off turns off the commandoutput
  • cmd launches a new commandline window
  • /q stands for quiet like @echo off
  • /c stands for a command you like to execute
  • del stands for delete
  • %0 stands for the batchfile itself
  • the exit is not needed but you can add it if you like so